matklad / xshell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document that tests require a gnu-like shell

CAD97 opened this issue · comments

Specifically, running tests in Powershell, I ran into test failures (in the details below), but everything passed in Git Bash. Specifically, it looks like use of false and echo failed.

Tests don't necessarily need to pass in every shell context out there (though it would be convenient, since xshell is trying to make exactly that more practical); it'd just be nice to document the required environment.

Alternative solutions:

  • Rewrite the failing tests to not use echo/false, just (ab)using cargo, clippy, and/or rustc, which are known to be present instead
  • Provide shims for echo and false for prominent non-gnu-like shells as people request them
Test failures on Powershell
failures:

---- program_interpolation stdout ----
thread 'program_interpolation' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:34:46
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- ignore_status stdout ----
thread 'ignore_status' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `false`', tests\it.rs:82:55

---- interpolation_move stdout ----
thread 'interpolation_move' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:49:47

---- interpolation stdout ----
thread 'interpolation' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:27:46

---- multiline stdout ----
thread 'multiline' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:20:6

---- interpolation_concatenation stdout ----
thread 'interpolation_concatenation' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:42:54

---- exit_status stdout ----
thread 'exit_status' panicked at 'assertion failed: `(left == right)`
  left: `"command not found: `false`"`,
 right: `"command `false` failed, exit code: 1"`', tests\it.rs:77:5

---- interpolation_spat stdout ----
thread 'interpolation_spat' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:59:59

---- escape stdout ----
thread 'escape' panicked at 'called `Result::unwrap()` on an `Err` value: command not found: `echo`', tests\it.rs:107:60

failures:
    escape
    exit_status
    ignore_status
    interpolation
    interpolation_concatenation
    interpolation_move
    interpolation_spat
    multiline
    program_interpolation

test result: FAILED. 17 passed; 9 failed; 0 ignored; 0 measured; 0 filtered out; finished in 5.03s

We should fix test to not rely on external stuff. It would actually be useful to have a binary (in examples dir) which echoes its arguments in quotes.