From 85f9c7f28fc4618331647801b8a51b9671fb07fa Mon Sep 17 00:00:00 2001 From: Laurent Arnoud Date: Mon, 4 Dec 2017 00:08:57 +0100 Subject: [PATCH] Use simpler test for exec with stderr case --- tests/testenv/mod.rs | 5 ++++- tests/tests.rs | 25 +------------------------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/tests/testenv/mod.rs b/tests/testenv/mod.rs index 60788e8..ef8b284 100644 --- a/tests/testenv/mod.rs +++ b/tests/testenv/mod.rs @@ -60,8 +60,11 @@ fn create_working_directory() -> Result { // 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( diff --git a/tests/tests.rs b/tests/tests.rs index 46ba94a..da5b94a 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -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", "{}"],