1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

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.
This commit is contained in:
Michael Debertol 2021-06-22 15:31:49 +02:00
parent 622504467f
commit ce0801db90

View file

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