mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37: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
|
@ -55,7 +55,7 @@ fn test_no_args() {
|
|||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -107,24 +107,21 @@ fn test_whitespace_delimited() {
|
|||
fn test_whitespace_with_explicit_delimiter() {
|
||||
new_ucmd!()
|
||||
.args(&["-w", "-f", COMPLEX_SEQUENCE.sequence, "-d:"])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
.fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitespace_with_byte() {
|
||||
new_ucmd!()
|
||||
.args(&["-w", "-b", COMPLEX_SEQUENCE.sequence])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
.fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_whitespace_with_char() {
|
||||
new_ucmd!()
|
||||
.args(&["-c", COMPLEX_SEQUENCE.sequence, "-w"])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
.fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -132,9 +129,9 @@ fn test_delimiter_with_byte_and_char() {
|
|||
for conflicting_arg in ["-c", "-b"] {
|
||||
new_ucmd!()
|
||||
.args(&[conflicting_arg, COMPLEX_SEQUENCE.sequence, "-d="])
|
||||
.fails()
|
||||
.fails_with_code(1)
|
||||
.stderr_is("cut: invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields\n")
|
||||
.code_is(1);
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,8 +139,7 @@ fn test_delimiter_with_byte_and_char() {
|
|||
fn test_too_large() {
|
||||
new_ucmd!()
|
||||
.args(&["-b1-18446744073709551615", "/dev/null"])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
.fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -240,8 +236,7 @@ fn test_is_a_directory() {
|
|||
|
||||
ucmd.arg("-b1")
|
||||
.arg("some")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_is("cut: some: Is a directory\n");
|
||||
}
|
||||
|
||||
|
@ -250,8 +245,7 @@ fn test_no_such_file() {
|
|||
new_ucmd!()
|
||||
.arg("-b1")
|
||||
.arg("some")
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_is("cut: some: No such file or directory\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue