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

@ -8,7 +8,7 @@ use crate::common::util::TestScenario;
#[test]
fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
}
#[test]
@ -459,8 +459,7 @@ fn test_sorted() {
scene
.ucmd()
.args(&["comm1", "comm2"])
.fails()
.code_is(1)
.fails_with_code(1)
.stdout_is("1\n\t\t3\n\t2\n")
.stderr_is(expected_stderr);
}
@ -477,8 +476,7 @@ fn test_sorted_check_order() {
.ucmd()
.arg("--check-order")
.args(&["comm1", "comm2"])
.fails()
.code_is(1)
.fails_with_code(1)
.stdout_is("1\n\t\t3\n")
.stderr_is(expected_stderr);
}
@ -493,8 +491,7 @@ fn test_both_inputs_out_of_order() {
scene
.ucmd()
.args(&["file_a", "file_b"])
.fails()
.code_is(1)
.fails_with_code(1)
.stdout_is("\t\t3\n1\n0\n\t2\n\t0\n")
.stderr_is(
"comm: file 1 is not in sorted order\n\
@ -513,8 +510,7 @@ fn test_both_inputs_out_of_order_last_pair() {
scene
.ucmd()
.args(&["file_a", "file_b"])
.fails()
.code_is(1)
.fails_with_code(1)
.stdout_is("\t\t3\n1\n\t2\n")
.stderr_is(
"comm: file 1 is not in sorted order\n\
@ -533,8 +529,7 @@ fn test_first_input_out_of_order_extended() {
scene
.ucmd()
.args(&["file_a", "file_b"])
.fails()
.code_is(1)
.fails_with_code(1)
.stdout_is("0\n\t2\n\t\t3\n1\n")
.stderr_is(
"comm: file 1 is not in sorted order\n\