Skip to content
Myr

fix(tests): restrict 'cat' tests to unix environments. Fixes #776 (#777)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Tests using the 'cat' command are specific to unix-like environments and fail on unsupported platforms.

authored by Ritvik · committed by GitHub · parent f6794c3 · Browse files · 1 file+8 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−2 removed

  • tests:+8 added−2 removed

1 file+8 added−2 removed

modified:tests/integration_tests.rs+8 added-2 removed
1 unmodified line
2use common::hyperfine;34use predicates::prelude::*;56/// Platform-specific I/O utility.7/// - On Unix-like systems, defaults to `cat`.8/// - On Windows, uses `findstr` as an alternative.9/// See: <https://superuser.com/questions/853580/real-windows-equivalent-to-cat-stdin>10const STDIN_READ_COMMAND: &str = if cfg!(windows) { "findstr x*" } else { "cat" };1112pub fn hyperfine_debug() -> assert_cmd::Command {13 let mut cmd = hyperfine();14 cmd.arg("--debug-mode");15 cmd
295 unmodified lines
311 hyperfine()312 .arg("--runs=1")313 .arg("--input=example_input_file.txt")314 .arg("--show-output")309 .arg("cat")315 .arg(STDIN_READ_COMMAND)316 .assert()317 .success()318 .stdout(predicate::str::contains("This text is part of a file"));319}
3 unmodified lines
323 hyperfine()324 .arg("--runs=1")325 .arg("--input=example_non_existent_file.txt")326 .arg("--show-output")321 .arg("cat")327 .arg(STDIN_READ_COMMAND)328 .assert()329 .failure()330 .stderr(predicate::str::contains(331 "The file 'example_non_existent_file.txt' specified as '--input' does not exist",
309 unmodified lines