Skip to content

Commit 1ca4a08

Browse files
committed
fix: Make MD005 Unicode test order-independent
The test was failing because it expected violations to be returned in line order, but MD005 returns them in detection order. Changed the test to check for the presence of violations on specific lines rather than relying on array indices. This fixes the flaky test that was passing locally but failing in CI.
1 parent bc81a5c commit 1ca4a08

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

tests/rules/md005_unicode_test.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,21 @@ fn test_unicode_list_items_invalid() {
3535
3,
3636
"Unicode list items with incorrect indentation should trigger warnings"
3737
);
38-
assert_eq!(result[0].line, 2); // 1 space instead of 2
39-
assert_eq!(result[1].line, 3); // 3 spaces instead of 4
40-
assert_eq!(result[2].line, 4); // 2 spaces instead of 4 (should match line 3's level)
38+
39+
// Check that we have violations on the expected lines (order may vary)
40+
let violation_lines: Vec<usize> = result.iter().map(|w| w.line).collect();
41+
assert!(
42+
violation_lines.contains(&2),
43+
"Should have violation on line 2 (1 space instead of 2)"
44+
);
45+
assert!(
46+
violation_lines.contains(&3),
47+
"Should have violation on line 3 (3 spaces instead of 4)"
48+
);
49+
assert!(
50+
violation_lines.contains(&4),
51+
"Should have violation on line 4 (2 spaces instead of 4)"
52+
);
4153
}
4254

4355
#[test]

0 commit comments

Comments
 (0)