-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve test case for experimental API remove_matches #114111
Improve test case for experimental API remove_matches #114111
Conversation
…c/tests/string.rs
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
@bors r+ rollup |
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#114111 (Improve test case for experimental API remove_matches) - rust-lang#114169 (refactor builtin unsize handling, extend comments) - rust-lang#114182 (clean up after 113312) - rust-lang#114193 (Update lexer emoji diagnostics to Unicode 15.0) - rust-lang#114200 (Detect trait upcasting through struct tail unsizing in new solver select) - rust-lang#114228 (Check lazy type aliases for well-formedness) - rust-lang#114267 (Map RPITIT's opaque type bounds back from projections to opaques) - rust-lang#114269 (Migrate GUI colors test to original CSS color format) - rust-lang#114286 (Add missing feature gate in multiple_supertrait_upcastable doc) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#112858 (Update Android system definitions and add riscv-linux-android as tier 3 target) - rust-lang#113717 (remove repetitive words) - rust-lang#113725 (Move MinGW linker dist option to proper section) - rust-lang#113740 (Update `.gitmodules` to use shallow submodule clones) - rust-lang#113889 (Fix ice tests when librustc-driver is linked dynamically) - rust-lang#113906 (etc: add `RUSTC_BOOTSTRAP` to rust-analyzer config) - rust-lang#113920 (fix(resolve): report unresolved imports firstly) - rust-lang#114111 (Improve test case for experimental API remove_matches) r? `@ghost` `@rustbot` modify labels: rollup
Add Test Cases for
remove_matches
FunctionMotivation
After reading the discussion in this GitHub thread, I'm trying to redesign the current API to use less memory when working with
String
and to make it simpler. I've discovered that some test cases are very helpful in ensuring that the new API behaves as intended. I'm still in the process of redesigning the current API, and these test cases have proven to be very useful.Testing
The current test has been tested with the command
./x test --stage 0 library/alloc
.Overview
This pull request adds several new test cases for the
remove_matches
function to make sure it works correctly in different situations. Theremove_matches
function is used to get rid of all instances of a specific pattern from a given text. These test cases thoroughly check how the function behaves in various scenarios.Test Cases
Single Pattern Occurrence (
test_single_pattern_occurrence
):Repeat Test Single Pattern Occurrence (
repeat_test_single_pattern_occurrence
):Single Character Pattern (
test_single_character_pattern
):Pattern with Special Characters (
test_pattern_with_special_characters
):Pattern Empty Text and Pattern (
test_pattern_empty_text_and_pattern
):Pattern Empty Text (
test_pattern_empty_text
):Empty Pattern (
test_empty_pattern
):Multiple Consecutive Patterns 1 (
test_multiple_consecutive_patterns_1
):Multiple Consecutive Patterns 2 (
test_multiple_consecutive_patterns_2
):Case Insensitive Pattern (
test_case_insensitive_pattern
):