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

Fix the windows tests

This commit is contained in:
Sylvestre Ledru 2023-12-24 15:18:31 +01:00
parent ceecac110c
commit 15573579cc
3 changed files with 39 additions and 25 deletions

View file

@ -3571,12 +3571,15 @@ fn test_cp_seen_file() {
at.write("a/f", "a");
at.write("b/f", "b");
ts.ucmd()
.arg("a/f")
.arg("b/f")
.arg("c")
.fails()
.stderr_contains("will not overwrite just-created 'c/f' with 'b/f'");
let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails();
#[cfg(not(unix))]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c\\f' with 'b/f'"));
#[cfg(unix)]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c/f' with 'b/f'"));
assert!(at.plus("c").join("f").exists());

View file

@ -733,12 +733,16 @@ fn test_ln_seen_file() {
at.write("a/f", "a");
at.write("b/f", "b");
ts.ucmd()
.arg("a/f")
.arg("b/f")
.arg("c")
.fails()
.stderr_contains("will not overwrite just-created 'c/f' with 'b/f'");
let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails();
#[cfg(not(unix))]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c\\f' with 'b/f'"));
#[cfg(unix)]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c/f' with 'b/f'"));
assert!(at.plus("c").join("f").exists());
// b/f still exists

View file

@ -1480,12 +1480,16 @@ fn test_mv_seen_file() {
at.write("a/f", "a");
at.write("b/f", "b");
ts.ucmd()
.arg("a/f")
.arg("b/f")
.arg("c")
.fails()
.stderr_contains("will not overwrite just-created 'c/f' with 'b/f'");
let result = ts.ucmd().arg("a/f").arg("b/f").arg("c").fails();
#[cfg(not(unix))]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c\\f' with 'b/f'"));
#[cfg(unix)]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c/f' with 'b/f'"));
// a/f has been moved into c/f
assert!(at.plus("c").join("f").exists());
@ -1507,13 +1511,16 @@ fn test_mv_seen_multiple_files_to_directory() {
at.write("b/f", "b");
at.write("b/g", "g");
ts.ucmd()
.arg("a/f")
.arg("b/f")
.arg("b/g")
.arg("c")
.fails()
.stderr_contains("will not overwrite just-created 'c/f' with 'b/f'");
let result = ts.ucmd().arg("a/f").arg("b/f").arg("b/g").arg("c").fails();
#[cfg(not(unix))]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c\\f' with 'b/f'"));
#[cfg(unix)]
assert!(result
.stderr_str()
.contains("will not overwrite just-created 'c/f' with 'b/f'"));
assert!(!at.plus("a").join("f").exists());
assert!(at.plus("b").join("f").exists());
assert!(!at.plus("b").join("g").exists());