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 8905d54 commit e30c80c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions crates/ignore/src/default_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,26 @@ pub const DEFAULT_TYPES: &[(&str, &[&str])] = &[
]),
("zstd", &["*.zst", "*.zstd"]),
];

#[cfg(test)]
mod tests {
use super::DEFAULT_TYPES;

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

let Some(mut previous_name) = names.next() else { return; };

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 e30c80c

Please sign in to comment.