Skip to content

Commit dbee7fd

Browse files
test: fix weak and near-duplicate assertions in sanitize.rs (#720)
1 parent 9c38510 commit dbee7fd

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

src/sanitize.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,12 @@ mod tests {
587587

588588
#[test]
589589
fn test_sanitize_preserves_markdown_headings() {
590+
// Markdown headings and bare issue references must not be neutralized.
591+
// A bare "#123" (without a preceding bot keyword like "fixes") must NOT
592+
// be wrapped in backticks — this assertion would pass even if "#123"
593+
// were wrapped, so we assert the exact output instead.
590594
let input = "# Heading\n## Sub-heading\nIssue #123";
591-
let result = sanitize(input);
592-
assert!(result.contains("# Heading"));
593-
assert!(result.contains("## Sub-heading"));
594-
assert!(result.contains("#123"));
595+
assert_eq!(sanitize(input), input);
595596
}
596597

597598
// ── sanitize_config tests ─────────────────────────────────────────────
@@ -622,8 +623,10 @@ mod tests {
622623

623624
#[test]
624625
fn test_sanitize_config_removes_control_chars() {
625-
let input = "hello\x00world\x07!";
626-
assert_eq!(sanitize_config(input), "helloworld!");
626+
// ANSI escape sequences must be stripped through the config pipeline.
627+
// "\x1b[0m" is the ANSI reset code; it should be removed, joining "val" and "ue".
628+
let input = "val\x1b[0mue";
629+
assert_eq!(sanitize_config(input), "value");
627630
}
628631

629632
#[test]

0 commit comments

Comments
 (0)