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:
parent
76ad6042b5
commit
18cb7dcf9e
90 changed files with 448 additions and 732 deletions
|
@ -77,7 +77,7 @@ fn du_basics(s: &str) {
|
|||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -132,20 +132,17 @@ fn test_du_invalid_size() {
|
|||
ts.ucmd()
|
||||
.arg(format!("--{s}=1fb4t"))
|
||||
.arg("/tmp")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_only(format!("du: invalid suffix in --{s} argument '1fb4t'\n"));
|
||||
ts.ucmd()
|
||||
.arg(format!("--{s}=x"))
|
||||
.arg("/tmp")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_only(format!("du: invalid --{s} argument 'x'\n"));
|
||||
ts.ucmd()
|
||||
.arg(format!("--{s}=1Y"))
|
||||
.arg("/tmp")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_only(format!("du: --{s} argument '1Y' too large\n"));
|
||||
}
|
||||
}
|
||||
|
@ -1019,7 +1016,7 @@ fn test_du_symlink_fail() {
|
|||
|
||||
at.symlink_file("non-existing.txt", "target.txt");
|
||||
|
||||
ts.ucmd().arg("-L").arg("target.txt").fails().code_is(1);
|
||||
ts.ucmd().arg("-L").arg("target.txt").fails_with_code(1);
|
||||
}
|
||||
|
||||
#[cfg(not(windows))]
|
||||
|
@ -1086,8 +1083,7 @@ fn test_du_files0_from_with_invalid_zero_length_file_names() {
|
|||
|
||||
ts.ucmd()
|
||||
.arg("--files0-from=filelist")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stdout_contains("testfile")
|
||||
.stderr_contains("filelist:1: invalid zero-length file name")
|
||||
.stderr_contains("filelist:3: invalid zero-length file name");
|
||||
|
@ -1133,8 +1129,7 @@ fn test_du_files0_from_stdin_with_invalid_zero_length_file_names() {
|
|||
new_ucmd!()
|
||||
.arg("--files0-from=-")
|
||||
.pipe_in("\0\0")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_contains("-:1: invalid zero-length file name")
|
||||
.stderr_contains("-:2: invalid zero-length file name");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue