Skip to content

test: fix weak and near-duplicate assertions in sanitize.rs#720

Merged
jamesadevine merged 1 commit into
mainfrom
test-reducer/sanitize-fixes-177f05368407def4
May 23, 2026
Merged

test: fix weak and near-duplicate assertions in sanitize.rs#720
jamesadevine merged 1 commit into
mainfrom
test-reducer/sanitize-fixes-177f05368407def4

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Test Suite Reduction: src/sanitize.rs

What was wrong

  • test_sanitize_preserves_markdown_headings: used three weak contains() assertions instead of checking the full output. Critically, assert!(result.contains("#123")) would pass even if the implementation incorrectly wrapped bare #123 in backticks, hiding a regression in the bot-trigger neutralization guard (which should only wrap patterns like fixes #123, not a standalone #123).
  • test_sanitize_config_removes_control_chars: used the exact same input and expected value ("hello\x00world\x07!""helloworld!") as the unit test test_remove_null_and_bell, making it a near-duplicate that adds no incremental coverage.

Changes

Test Action Reason
test_sanitize_preserves_markdown_headings Rewritten Weak contains("#123") would pass even on a wrong implementation; replaced with assert_eq! on the full output
test_sanitize_config_removes_control_chars Rewritten Near-duplicate of test_remove_null_and_bell; now uses an ANSI escape sequence input (val\x1b[0muevalue) that is distinct from the null/bell test

Verification

  • cargo test: all 1660 tests pass ✅
  • cargo clippy --all-targets --all-features: no errors ✅

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • dev.azure.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "dev.azure.com"

See Network Configuration for more information.

Generated by Test Reducer · ● 11M ·

- test_sanitize_preserves_markdown_headings: replaced three weak
  contains() assertions with a single assert_eq! on the full output.
  The old assertion result.contains("#123") would pass even if the
  implementation incorrectly wrapped bare #123 in backticks, hiding
  a regression in the bot-trigger neutralization guard.

- test_sanitize_config_removes_control_chars: rewrote to use a
  distinct ANSI-sequence input (val + ESC[0m + ue → value) instead
  of duplicating the exact null/bell bytes already covered by
  test_remove_null_and_bell. The new input exercises ANSI sequence
  stripping through the config pipeline, which the old duplicate
  did not uniquely verify.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesadevine jamesadevine marked this pull request as ready for review May 23, 2026 14:13
@jamesadevine jamesadevine merged commit dbee7fd into main May 23, 2026
@jamesadevine jamesadevine deleted the test-reducer/sanitize-fixes-177f05368407def4 branch May 23, 2026 14:14
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