From e61b419c8338c6a69daef531221aae9127d42a74 Mon Sep 17 00:00:00 2001 From: Bertrand Bonnefoy-Claudet Date: Sat, 16 Sep 2023 14:39:40 +0200 Subject: [PATCH] Improve sensitivity of last two integration tests 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. --- tests/integration.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/integration.rs b/tests/integration.rs index a43ce3565..19e851126 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -758,8 +758,8 @@ 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") @@ -767,7 +767,8 @@ fn test_all_directory() { .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] @@ -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)); }