Skip to content

Commit

Permalink
ignore/types: add automated test for sortedness
Browse files Browse the repository at this point in the history
  • Loading branch information
arbrauns committed Nov 14, 2022
1 parent 0000157 commit b0f34d3
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/ignore/src/default_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,3 +290,22 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("zstd", &["*.zst", "*.zstd"]),
];

#[test]
fn test_default_types_are_sorted() {
let mut names = DEFAULT_TYPES.iter().map(|(name, _exts)| name);

if let Some(first) = names.next() {
let mut previous_name = first;
for name in names {
assert!(
name > previous_name,
r#""{}" should be sorted before "{}" in `DEFAULT_TYPES`"#,
name,
previous_name
);

previous_name = name;
}
}
}

0 comments on commit b0f34d3

Please sign in to comment.