Skip to content

Commit

Permalink
Improve sensitivity of last two integration tests
Browse files Browse the repository at this point in the history
Those tests were only checking that the output was nonempty, so they
would pretty much never detect anything fishy. We could go further but
it's nontrivial because the output is nondeterministic (because of
temporary files) and it's unclear if we want to build complex regexes in
the test suite right now. In the meantime, here's a basic improvement.
  • Loading branch information
bbc2 committed Sep 16, 2023
1 parent 762e724 commit e61b419
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -758,16 +758,17 @@ fn test_date_custom_format_supports_padding() {
#[test]
fn test_all_directory() {
let dir = tempdir();
dir.child("one").touch().unwrap();
dir.child("two").touch().unwrap();
dir.child("subdir-one").touch().unwrap();
dir.child("subdir-two").touch().unwrap();

cmd()
.arg("-a")
.arg("-d")
.arg("--ignore-config")
.arg(dir.path())
.assert()
.stdout(predicate::str::is_match(".").unwrap());
.stdout(predicate::str::contains("subdir-one").not())
.stdout(predicate::str::contains("subdir-two").not());
}

#[test]
Expand All @@ -777,8 +778,10 @@ fn test_multiple_files() {
dir.child("two").touch().unwrap();

cmd()
.arg("--ignore-config")
.arg(dir.path().join("one"))
.arg(dir.path().join("two"))
.assert()
.stdout(predicate::str::is_match(".").unwrap());
.stdout(predicate::str::is_match("one").unwrap().count(1))
.stdout(predicate::str::is_match("two").unwrap().count(1));
}

0 comments on commit e61b419

Please sign in to comment.