Skip to content

Commit

Permalink
reorder: add test for compare_opt_ident_as_versions
Browse files Browse the repository at this point in the history
  • Loading branch information
tanriol committed Mar 28, 2020
1 parent 8783f61 commit 31b8ef2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rustfmt-core/rustfmt-lib/src/reorder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,13 @@ mod tests {
strings = tail;
}
}
#[test]
fn test_compare_opt_ident_as_versions() {
use super::compare_opt_ident_as_versions;
use std::cmp::Ordering;
let items: &[Option<&'static str>] = &[None, Some("a"), Some("r#a"), Some("a")];
for (p, n) in items[..items.len() - 1].iter().zip(items[1..].iter()) {
assert!(compare_opt_ident_as_versions(p, n) != Ordering::Greater);
}
}
}

0 comments on commit 31b8ef2

Please sign in to comment.