From b3c002238625451030ec241d051baf8c214b33c5 Mon Sep 17 00:00:00 2001 From: David Peter Date: Sun, 6 Feb 2022 13:48:39 +0100 Subject: [PATCH] Add more integration tests --- tests/integration_tests.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 1ff1c3a..d4adeff 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -31,3 +31,33 @@ fn fails_with_wrong_number_of_command_name_arguments() { .failure() .stderr(predicate::str::contains("Too many --command-name options")); } + +#[test] +fn fails_for_unknown_command() { + hyperfine() + .arg("some-nonexisting-program-b5d9574198b7e4b12a71fa4747c0a577") + .assert() + .failure() + .stderr(predicate::str::contains( + "Command terminated with non-zero exit code", + )); +} + +#[cfg(unix)] +#[test] +fn can_run_failing_commands_with_ignore_failure_option() { + hyperfine() + .arg("false") + .assert() + .failure() + .stderr(predicate::str::contains( + "Command terminated with non-zero exit code", + )); + + hyperfine() + .arg("--runs=1") + .arg("--ignore-failure") + .arg("false") + .assert() + .success(); +}