Use simpler test for exec with stderr case

This commit is contained in:
Laurent Arnoud 2017-12-04 00:08:57 +01:00
parent 3b8c87fb65
commit 85f9c7f28f
No known key found for this signature in database
GPG Key ID: A79DAB2374F95DD5
2 changed files with 5 additions and 25 deletions

View File

@ -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(

View File

@ -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", "{}"],