mirror of https://github.com/sharkdp/fd.git
Use simpler test for exec with stderr case
This commit is contained in:
parent
3b8c87fb65
commit
85f9c7f28f
|
@ -60,8 +60,11 @@ fn create_working_directory() -> Result<TempDir, io::Error> {
|
|||
// is by default only granted for administrators.
|
||||
#[cfg(windows)] windows::fs::symlink_dir(root.join("one/two"), root.join("symlink"))?;
|
||||
|
||||
fs::File::create(root.join("echo_err.sh"))?.write_all(
|
||||
b"echo $* 1>&2",
|
||||
)?;
|
||||
fs::File::create(root.join(".ignore"))?.write_all(
|
||||
b"ignored.foo",
|
||||
b"ignored.foo\necho_err.sh",
|
||||
)?;
|
||||
|
||||
fs::File::create(root.join(".gitignore"))?.write_all(
|
||||
|
|
|
@ -14,7 +14,6 @@ mod testenv;
|
|||
|
||||
use testenv::TestEnv;
|
||||
use regex::escape;
|
||||
use std::env;
|
||||
|
||||
fn get_absolute_root_path(env: &TestEnv) -> String {
|
||||
let path = env.test_root()
|
||||
|
@ -645,29 +644,7 @@ fn test_exec() {
|
|||
),
|
||||
);
|
||||
|
||||
// On travis Trusty quotes are differents with `rm -i`
|
||||
// ‘a.foo’ instead of locally 'a.foo'
|
||||
match env::var("TRAVIS_OS_NAME") {
|
||||
Ok(val) => {
|
||||
if val == "linux" {
|
||||
te.assert_output_error(
|
||||
&["a.foo", "--exec", "rm", "-i", "{}"],
|
||||
"rm: remove regular empty file ‘a.foo’? ",
|
||||
);
|
||||
} else if val == "osx" {
|
||||
te.assert_output_error(
|
||||
&["a.foo", "--exec", "rm", "-i", "{}"],
|
||||
"remove a.foo? ",
|
||||
);
|
||||
}
|
||||
}
|
||||
Err(_) => {
|
||||
te.assert_output_error(
|
||||
&["a.foo", "--exec", "rm", "-i", "{}"],
|
||||
"rm: remove regular empty file 'a.foo'? ",
|
||||
);
|
||||
}
|
||||
}
|
||||
te.assert_output_error(&["a.foo", "--exec", "sh", "echo_err.sh", "{}"], "a.foo");
|
||||
|
||||
te.assert_output(
|
||||
&["foo", "--exec", "echo", "{}"],
|
||||
|
|
Loading…
Reference in New Issue