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

Use the new function fails_with_code

Done with
```
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.no_stdout\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2)\n\1.no_stdout();/gs' *rs
$ sed -i -e "s|.fails()(.*).code_is(|.fails_with_code(|g" *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)[ \t]*\n[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\2);/gs' *rs
$ perl -0777 -i -pe 's/([ \t]+)\.fails\(\)(.*?)[ \t]+\.code_is\(([0-9]+)\);/\1.fails_with_code(\3)\2;/gs' *rs
...
```
This commit is contained in:
Sylvestre Ledru 2025-03-01 15:29:11 +01:00
parent 76ad6042b5
commit 18cb7dcf9e
90 changed files with 448 additions and 732 deletions

View file

@ -185,8 +185,7 @@ fn test_cp_same_file() {
ucmd.arg(file)
.arg(file)
.fails()
.code_is(1)
.fails_with_code(1)
.stderr_contains(format!("'{file}' and '{file}' are the same file"));
}
@ -664,8 +663,7 @@ fn test_cp_arg_interactive_update_overwrite_older() {
at.touch("a");
ucmd.args(&["-i", "-u", "a", "b"])
.pipe_in("N\n")
.fails()
.code_is(1)
.fails_with_code(1)
.no_stdout()
.stderr_is("cp: overwrite 'b'? ");
@ -1720,8 +1718,7 @@ fn test_cp_preserve_invalid_rejected() {
.arg("--preserve=invalid-value")
.arg(TEST_COPY_FROM_FOLDER_FILE)
.arg(TEST_HELLO_WORLD_DEST)
.fails()
.code_is(1)
.fails_with_code(1)
.no_stdout();
}
@ -3465,8 +3462,7 @@ fn test_copy_dir_preserve_permissions_inaccessible_file() {
// | | | |
// V V V V
ucmd.args(&["-p", "-R", "d1", "d2"])
.fails()
.code_is(1)
.fails_with_code(1)
.stderr_only("cp: cannot open 'd1/f' for reading: permission denied\n");
assert!(at.dir_exists("d2"));
assert!(!at.file_exists("d2/f"));
@ -5979,16 +5975,14 @@ fn test_cp_with_options_backup_and_rem_when_dest_is_symlink() {
fn test_cp_single_file() {
let (_at, mut ucmd) = at_and_ucmd!();
ucmd.arg(TEST_HELLO_WORLD_SOURCE)
.fails()
.code_is(1)
.fails_with_code(1)
.stderr_contains("missing destination file");
}
#[test]
fn test_cp_no_file() {
let (_at, mut ucmd) = at_and_ucmd!();
ucmd.fails()
.code_is(1)
ucmd.fails_with_code(1)
.stderr_contains("error: the following required arguments were not provided:");
}