Skip to content

refactor(test): use ansi_str::AnsiStr for stripping in custom tests - #2669

Merged
max-sixty merged 1 commit into
mainfrom
refactor/issue-2663-test-strip-ansi
May 10, 2026
Merged

max-sixty merged 1 commit into
mainfrom
refactor/issue-2663-test-strip-ansi

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

tests/integration_tests/custom.rs:122-139 carried a hand-rolled strip_ansi (CSI walker) duplicating ansi_str::AnsiStr::ansi_strip(). ansi_str is already a direct dep (Cargo.toml:82) and the same call is already used by tests/integration_tests/{switch,remove,ci_status,column_alignment_verification,readme_sync}.rs. Drop the local helper, import AnsiStr, and call ansi_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 fmt clean

Closes part of #2663.

`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]>
@max-sixty
max-sixty merged commit be5a962 into main May 10, 2026
31 checks passed
@max-sixty
max-sixty deleted the refactor/issue-2663-test-strip-ansi branch May 10, 2026 14:59
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.

2 participants