Skip to content

tests: add edge-case tests for str_sort(), str_order(), and str_rank()#612

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

tests: add edge-case tests for str_sort(), str_order(), and str_rank()#612
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/str-sort-edge-cases

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Adds edge-case tests for str_sort(), str_order(), and str_rank() covering common data cleaning scenarios that had limited test coverage.

Changes

  • tests/testthat/test-sort.R: +77 lines (14 new test blocks, 28 new expectations)

Tests Added

  1. Empty inputcharacter(0) for all three functions
  2. Single elementstr_sort(), str_order(), str_rank()
  3. All NA inputstr_sort() with na_last = TRUE and na_last = FALSE
  4. NA droppingstr_sort() with na_last = NA
  5. Decreasing orderstr_sort() and str_order()
  6. Mixed case sortingstr_sort() with default locale
  7. Names preservationstr_order() preserves names through indexing
  8. Single NA handlingstr_sort() with various na_last options

Validation

  • All tests pass: [ FAIL 0 | WARN 0 | SKIP 0 | PASS 31 ] (28 existing + 14 new)
  • No regressions
  • Source-grounded: tests match actual function signatures and documented behavior

Related

  • Covers data cleaning edge cases for string sorting/ordering operations
  • No duplicate PRs found

Add tests for:
- Empty input (character(0)) for all three functions
- Single element input
- All NA input
- NA dropping with na_last = NA
- Decreasing order
- Mixed case sorting
- Names preservation for str_order()
- Single NA handling
@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