diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 873f400..4efe20c 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -3,6 +3,12 @@ use common::hyperfine; use predicates::prelude::*; +/// Platform-specific I/O utility. +/// - On Unix-like systems, defaults to `cat`. +/// - On Windows, uses `findstr` as an alternative. +/// See: +const STDIN_READ_COMMAND: &str = if cfg!(windows) { "findstr x*" } else { "cat" }; + pub fn hyperfine_debug() -> assert_cmd::Command { let mut cmd = hyperfine(); cmd.arg("--debug-mode"); @@ -306,7 +312,7 @@ fn can_pass_input_to_command_from_a_file() { .arg("--runs=1") .arg("--input=example_input_file.txt") .arg("--show-output") - .arg("cat") + .arg(STDIN_READ_COMMAND) .assert() .success() .stdout(predicate::str::contains("This text is part of a file")); @@ -318,7 +324,7 @@ fn fails_if_invalid_stdin_data_file_provided() { .arg("--runs=1") .arg("--input=example_non_existent_file.txt") .arg("--show-output") - .arg("cat") + .arg(STDIN_READ_COMMAND) .assert() .failure() .stderr(predicate::str::contains(