Skip to content

Commit b0f34d3

Browse files
committed
ignore/types: add automated test for sortedness
1 parent 0000157 commit b0f34d3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

crates/ignore/src/default_types.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,22 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
290290
]),
291291
("zstd", &["*.zst", "*.zstd"]),
292292
];
293+
294+
#[test]
295+
fn test_default_types_are_sorted() {
296+
let mut names = DEFAULT_TYPES.iter().map(|(name, _exts)| name);
297+
298+
if let Some(first) = names.next() {
299+
let mut previous_name = first;
300+
for name in names {
301+
assert!(
302+
name > previous_name,
303+
r#""{}" should be sorted before "{}" in `DEFAULT_TYPES`"#,
304+
name,
305+
previous_name
306+
);
307+
308+
previous_name = name;
309+
}
310+
}
311+
}

0 commit comments

Comments
 (0)