Skip to content

tests: add edge-case tests for str_remove() and str_remove_all()#608

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

tests: add edge-case tests for str_remove() and str_remove_all()#608
LeonidasZhak wants to merge 1 commit into
tidyverse:mainfrom
LeonidasZhak:tests/str-remove-edge-cases

Conversation

@LeonidasZhak

Copy link
Copy Markdown

Summary

Adds edge-case test coverage for str_remove() and str_remove_all():

  • NA handling: Tests that both functions correctly propagate NA values (single and mixed with non-NA)
  • Empty strings: Tests behavior with empty string input
  • Zero-length vectors: Tests that character() input returns character()
  • Factor input: Tests factor-to-character coercion works correctly
  • No match: Tests that non-matching patterns return the original string

Motivation

str_remove() and str_remove_all() are thin wrappers around str_replace()/str_replace_all(), but the test file (9 lines) had zero coverage for these common data-cleaning edge cases. The DESCRIPTION claims all functions deal with NAs and zero-length vectors consistently — these tests verify that claim for the remove family.

Tests run

[ FAIL 0 | WARN 0 | SKIP 0 | PASS 15 ]

All 15 remove tests pass (5 new test blocks, 13 new assertions). Full suite has 2 pre-existing snapshot failures (lifecycle wording changes), unrelated to this work.

Add tests for NA propagation, empty strings, zero-length input,
factor coercion, and no-match behavior. These data-cleaning edge
cases had no coverage despite str_remove/str_remove_all being
commonly used in cleaning workflows.
@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