Skip to content

tests: add edge-case tests for hoist() with .remove = FALSE - #1644

Closed
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/hoist-remove-false-edge-cases
Closed

tests: add edge-case tests for hoist() with .remove = FALSE#1644
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/hoist-remove-false-edge-cases

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Adds 5 test blocks (83 lines) for hoist() behavior when .remove = FALSE, covering scenarios that had no test coverage.

Motivation

The .remove parameter defaults to TRUE and that path is well tested. But .remove = FALSE — which preserves the original list-column after extraction — had zero dedicated tests. This is a documented parameter used in data cleaning pipelines where you want to peek into list-columns without dismantling them.

Tests Added

  1. Preserves original list-column — Extracts named elements, verifies the list-column remains unchanged
  2. Preserves list-column when all elements extracted — Even when every element is hoisted out, the column stays
  3. Works with empty data frames — 0-row input with empty list-column
  4. Preserves grouped data frame class — Grouping is maintained through hoisting
  5. Handles multiple pluckers — Multiple extractions in a single call with .remove = FALSE

Validation

Rscript -e 'devtools::test(filter = hoist)'
# [ FAIL 0 | WARN 0 | SKIP 0 | PASS 63 ]

All 61 existing tests pass. 2 new tests added (5 test blocks, 83 lines, 1 file changed).

Add 5 test blocks covering hoist() behavior when .remove = FALSE:

1. Preserves original list-column when extracting named elements
2. Preserves list-column even when all elements are extracted
3. Works with empty data frames (0 rows)
4. Preserves grouped data frame class
5. Handles multiple pluckers simultaneously

These scenarios had no test coverage despite .remove being a documented
parameter. The default .remove = TRUE was already well tested.
@LeonidasZhak

Copy link
Copy Markdown
Author

Withdrawing this small automated PR while I consolidate an oversized batch of contributions and reduce maintainer review burden. Sorry for the noise, and thank you for maintaining the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant