Repository navigation
refactor(test): use ansi_str::AnsiStr for stripping in custom tests - #2669
Merged
Merged
Conversation
`tests/integration_tests/custom.rs` carried a hand-rolled `strip_ansi` that re-implements what `ansi_str::AnsiStr::ansi_strip()` already does — and `ansi_str` is already pulled in transitively (via src/styling) and used directly by switch/remove/ci_status/column_alignment tests. Drop the local helper and call `ansi_strip().into_owned()` at the three sites. Closes part of #2663. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tests/integration_tests/custom.rs:122-139carried a hand-rolledstrip_ansi(CSI walker) duplicatingansi_str::AnsiStr::ansi_strip().ansi_stris already a direct dep (Cargo.toml:82) and the same call is already used bytests/integration_tests/{switch,remove,ci_status,column_alignment_verification,readme_sync}.rs. Drop the local helper, importAnsiStr, and callansi_strip().into_owned()at the three sites.CLAUDE.md "Use Existing Dependencies" applies directly here.
Test plan
cargo test --test integration custom_subcommand_typo_suggests_closest_builtin custom_subcommand_not_found_prints_clap_error custom_subcommand_nested_suggestion_wins_over_path_lookup— all three pass (these are the only tests that touched the helper)cargo fmtcleanCloses part of #2663.