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
|
@ -189,8 +189,7 @@ fn test_error_filename_only() {
|
|||
// truncate: you must specify either '--size' or '--reference'
|
||||
new_ucmd!()
|
||||
.args(&["file"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_contains("error: the following required arguments were not provided:");
|
||||
}
|
||||
|
||||
|
@ -199,8 +198,7 @@ fn test_invalid_option() {
|
|||
// truncate: cli parsing error returns 1
|
||||
new_ucmd!()
|
||||
.args(&["--this-arg-does-not-exist"])
|
||||
.fails()
|
||||
.code_is(1);
|
||||
.fails_with_code(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -242,13 +240,11 @@ fn test_truncate_bytes_size() {
|
|||
.succeeds();
|
||||
new_ucmd!()
|
||||
.args(&["--size", "1024R", "file"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_only("truncate: Invalid number: '1024R': Value too large for defined data type\n");
|
||||
new_ucmd!()
|
||||
.args(&["--size", "1Y", "file"])
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.fails_with_code(1)
|
||||
.stderr_only("truncate: Invalid number: '1Y': Value too large for defined data type\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue