mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-05-19 09:40:22 -07:00
ignore/types: add automated test for sortedness
People occasionally get this wrong and I've been manually checking it. Instead, let's have CI do it automatically. PR #2351
This commit is contained in:
parent
8905d54a9f
commit
7f23cd63a5
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user