Skip to content

Commit 31b8ef2

Browse files
committed
reorder: add test for compare_opt_ident_as_versions
1 parent 8783f61 commit 31b8ef2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

rustfmt-core/rustfmt-lib/src/reorder.rs

+9
Original file line numberDiff line numberDiff line change
@@ -403,4 +403,13 @@ mod tests {
403403
strings = tail;
404404
}
405405
}
406+
#[test]
407+
fn test_compare_opt_ident_as_versions() {
408+
use super::compare_opt_ident_as_versions;
409+
use std::cmp::Ordering;
410+
let items: &[Option<&'static str>] = &[None, Some("a"), Some("r#a"), Some("a")];
411+
for (p, n) in items[..items.len() - 1].iter().zip(items[1..].iter()) {
412+
assert!(compare_opt_ident_as_versions(p, n) != Ordering::Greater);
413+
}
414+
}
406415
}

0 commit comments

Comments
 (0)