mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-28 08:08:58 +00:00
Tests using the 'cat' command are specific to unix-like environments and fail on unsupported platforms.
This commit is contained in:
1 parent
f6794c313c
commit
3bd38f275e
1 file changed
+8
-2
@@ -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: <https://superuser.com/questions/853580/real-windows-equivalent-to-cat-stdin>
|
||||
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(
|
||||
|
||||
Reference in new issue
Block a user