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

tests/util: Introduce CmdResult::stdout_str_apply ... to preprocess stdout, stderr before asserting

This commit is contained in:
Joining7943 2022-11-30 07:35:52 +01:00
parent 3977ef608e
commit 37e06edadc
3 changed files with 83 additions and 13 deletions

View file

@ -503,11 +503,10 @@ fn test_rm_force_prompts_order() {
child.try_write_in(yes.as_bytes()).unwrap();
let result = child.wait().unwrap();
let string_output = result.stderr_str();
assert_eq!(
string_output.trim(),
"rm: remove regular empty file 'empty'?"
);
result
.stderr_str_apply(str::trim)
.stderr_only("rm: remove regular empty file 'empty'?");
assert!(!at.file_exists(empty_file));
at.touch(empty_file);