Simplify boolean assertions in tests

This commit is contained in:
Victor Song 2022-09-30 23:43:14 -04:00
parent bbea87db91
commit 72b2119a34
3 changed files with 12 additions and 12 deletions

View File

@ -346,31 +346,31 @@ mod test_ignores {
#[test] #[test]
fn empty_matches_nothing() { fn empty_matches_nothing() {
let pats = IgnorePatterns::empty(); let pats = IgnorePatterns::empty();
assert_eq!(false, pats.is_ignored("nothing")); assert!(!pats.is_ignored("nothing"));
assert_eq!(false, pats.is_ignored("test.mp3")); assert!(!pats.is_ignored("test.mp3"));
} }
#[test] #[test]
fn ignores_a_glob() { fn ignores_a_glob() {
let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "*.mp3" ]); let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "*.mp3" ]);
assert!(fails.is_empty()); assert!(fails.is_empty());
assert_eq!(false, pats.is_ignored("nothing")); assert!(!pats.is_ignored("nothing"));
assert_eq!(true, pats.is_ignored("test.mp3")); assert!(pats.is_ignored("test.mp3"));
} }
#[test] #[test]
fn ignores_an_exact_filename() { fn ignores_an_exact_filename() {
let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "nothing" ]); let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "nothing" ]);
assert!(fails.is_empty()); assert!(fails.is_empty());
assert_eq!(true, pats.is_ignored("nothing")); assert!(pats.is_ignored("nothing"));
assert_eq!(false, pats.is_ignored("test.mp3")); assert!(!pats.is_ignored("test.mp3"));
} }
#[test] #[test]
fn ignores_both() { fn ignores_both() {
let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "nothing", "*.mp3" ]); let (pats, fails) = IgnorePatterns::parse_from_iter(vec![ "nothing", "*.mp3" ]);
assert!(fails.is_empty()); assert!(fails.is_empty());
assert_eq!(true, pats.is_ignored("nothing")); assert!(pats.is_ignored("nothing"));
assert_eq!(true, pats.is_ignored("test.mp3")); assert!(pats.is_ignored("test.mp3"));
} }
} }

View File

@ -743,6 +743,6 @@ mod matches_test {
fn no_count() { fn no_count() {
let flags = MatchedFlags { flags: Vec::new(), strictness: Strictness::UseLastArguments }; let flags = MatchedFlags { flags: Vec::new(), strictness: Strictness::UseLastArguments };
assert_eq!(flags.has(&COUNT).unwrap(), false); assert!(!flags.has(&COUNT).unwrap());
} }
} }

View File

@ -257,15 +257,15 @@ mod iter_test {
let next = iter.next().unwrap(); let next = iter.next().unwrap();
assert_eq!(&"first", next.1); assert_eq!(&"first", next.1);
assert_eq!(false, next.0.last); assert!(!next.0.last);
let next = iter.next().unwrap(); let next = iter.next().unwrap();
assert_eq!(&"middle", next.1); assert_eq!(&"middle", next.1);
assert_eq!(false, next.0.last); assert!(!next.0.last);
let next = iter.next().unwrap(); let next = iter.next().unwrap();
assert_eq!(&"last", next.1); assert_eq!(&"last", next.1);
assert_eq!(true, next.0.last); assert!(next.0.last);
assert!(iter.next().is_none()); assert!(iter.next().is_none());
} }