From 4d3314f26f9728e9f9aae285df1e71bbe53ea93c Mon Sep 17 00:00:00 2001 From: David Peter Date: Sun, 6 Feb 2022 13:54:09 +0100 Subject: [PATCH] Add integration test for prepare option --- tests/integration_tests.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index d4adeff..1e235b0 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -32,6 +32,30 @@ fn fails_with_wrong_number_of_command_name_arguments() { .stderr(predicate::str::contains("Too many --command-name options")); } +#[test] +fn fails_with_wrong_number_of_prepare_options() { + hyperfine() + .arg("--runs=1") + .arg("--prepare=echo a") + .arg("--prepare=echo b") + .arg("echo a") + .arg("echo b") + .assert() + .success(); + + hyperfine() + .arg("--prepare=echo a") + .arg("--prepare=echo b") + .arg("echo a") + .arg("echo b") + .arg("echo c") + .assert() + .failure() + .stderr(predicate::str::contains( + "The '--prepare' option has to be provided", + )); +} + #[test] fn fails_for_unknown_command() { hyperfine()