Skip to content

test: add edge-case tests for fct_cross()#402

Closed
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/fct-cross-edge-cases
Closed

test: add edge-case tests for fct_cross()#402
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/fct-cross-edge-cases

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Adds 11 edge-case tests for fct_cross() covering scenarios not previously tested.

Tests Added

  • Explicit NA levels (exclude = NULL): NA levels are treated as regular levels in cross combinations (e.g., "NA:y"), and NA values are not introduced
  • keep_empty with explicit NA levels: All combinations including "NA:NA" are generated
  • Custom separator: sep = "-" and sep = "" work correctly with keep_empty
  • Single-level factors: Single-level cross produces a single combined level
  • Ordered input: fct_cross() returns a regular factor (not ordered), even when input is ordered

Validation

  • devtools::test(filter = "cross"): PASS 21 (10 pre-existing + 11 new, 0 failures)
  • 1 file changed: tests/testthat/test-cross.R (+47 lines)

- Explicit NA levels (exclude = NULL) treated as regular levels
- keep_empty with explicit NA levels generates all combinations
- Custom separator with keep_empty
- Single-level factors
- Ordered input returns regular factor (not ordered)
@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