From ce0801db909c979ad2cce37d25879159d71dbbc2 Mon Sep 17 00:00:00 2001 From: Michael Debertol Date: Tue, 22 Jun 2021 15:31:49 +0200 Subject: [PATCH] tests/mv: test uutils mv instead of system util Calling `cmd_keepenv("mv")` spawned the system `mv` instead of the uutils `mv`. Also, `keepenv` isn't necessary because it doesn't need to inherit environment variables. We now actually check the stderr, because previously the result of `ends_with` was not used, making the test pass even when it shouldn't. I disabled the test on windows because `mkdir` does not support `-m` on windows, making the test fail because there will be no permission error. On FreeBSD there isn't a permission error either, and `mv` succeeds. --- tests/by-util/test_mv.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/by-util/test_mv.rs b/tests/by-util/test_mv.rs index 2f35bf5eb..d8733a4f0 100644 --- a/tests/by-util/test_mv.rs +++ b/tests/by-util/test_mv.rs @@ -729,6 +729,7 @@ fn test_mv_verbose() { } #[test] +#[cfg(target_os = "linux")] // mkdir does not support -m on windows. Freebsd doesn't return a permission error either. fn test_mv_permission_error() { let scene = TestScenario::new("mkdir"); let folder1 = "bar"; @@ -738,12 +739,11 @@ fn test_mv_permission_error() { scene.ucmd().arg("-m777").arg(folder2).succeeds(); scene - .cmd_keepenv(util_name!()) + .ccmd("mv") .arg(folder2) .arg(folder_to_move) - .run() - .stderr_str() - .ends_with("Permission denied"); + .fails() + .stderr_contains("Permission denied"); } // Todo: