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

tests/util: Do not trim stderr in CmdResult::stderr_is. Add method stderr_trimmed_is.

Fix tests assert whitespace instead of trimming it. Disable some tests in `test_tr` because `tr`
produces too many newlines.
This commit is contained in:
Joining7943 2023-01-05 21:09:15 +01:00
parent 7c0ed0340b
commit 1fadeb43b2
40 changed files with 229 additions and 211 deletions

View file

@ -48,7 +48,7 @@ fn test_invalid_group() {
.arg("__nosuchgroup__")
.arg("/")
.fails()
.stderr_is("chgrp: invalid group: '__nosuchgroup__'");
.stderr_is("chgrp: invalid group: '__nosuchgroup__'\n");
}
#[test]
@ -92,7 +92,7 @@ fn test_preserve_root() {
.arg("-R")
.arg("bin").arg(d)
.fails()
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe");
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe\n");
}
}
@ -111,7 +111,7 @@ fn test_preserve_root_symlink() {
.arg("-HR")
.arg("bin").arg(file)
.fails()
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe");
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe\n");
}
let (at, mut ucmd) = at_and_ucmd!();
@ -120,7 +120,7 @@ fn test_preserve_root_symlink() {
.arg("-HR")
.arg("bin").arg(format!(".//{}/..//..//../../", file))
.fails()
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe");
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe\n");
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("/", "__root__");
@ -128,7 +128,7 @@ fn test_preserve_root_symlink() {
.arg("-R")
.arg("bin").arg("__root__/.")
.fails()
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe");
.stderr_is("chgrp: it is dangerous to operate recursively on '/'\nchgrp: use --no-preserve-root to override this failsafe\n");
}
#[test]
@ -143,7 +143,7 @@ fn test_reference() {
.arg("--reference=/etc/passwd")
.arg("/etc")
.fails()
.stderr_is("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of '/etc' from root to root");
.stderr_is("chgrp: changing group of '/etc': Operation not permitted (os error 1)\nfailed to change group of '/etc' from root to root\n");
}
}
@ -270,7 +270,7 @@ fn test_permission_denied() {
.arg(group.as_raw().to_string())
.arg("dir")
.fails()
.stderr_only("chgrp: cannot access 'dir': Permission denied");
.stderr_only("chgrp: cannot access 'dir': Permission denied\n");
}
}
@ -289,7 +289,7 @@ fn test_subdir_permission_denied() {
.arg(group.as_raw().to_string())
.arg("dir")
.fails()
.stderr_only("chgrp: cannot access 'dir/subdir': Permission denied");
.stderr_only("chgrp: cannot access 'dir/subdir': Permission denied\n");
}
}