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
|
@ -7,7 +7,7 @@ use crate::common::util::TestScenario;
|
|||
|
||||
#[test]
|
||||
fn invalid_input() {
|
||||
new_ucmd!().arg("-/").fails().code_is(125);
|
||||
new_ucmd!().arg("-/").fails_with_code(125);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -15,8 +15,7 @@ fn test_permission() {
|
|||
new_ucmd!()
|
||||
.arg("-o1")
|
||||
.arg(".")
|
||||
.fails()
|
||||
.code_is(126)
|
||||
.fails_with_code(126)
|
||||
.stderr_contains("Permission denied");
|
||||
}
|
||||
|
||||
|
@ -25,8 +24,7 @@ fn test_no_such() {
|
|||
new_ucmd!()
|
||||
.arg("-o1")
|
||||
.arg("no_such")
|
||||
.fails()
|
||||
.code_is(127)
|
||||
.fails_with_code(127)
|
||||
.stderr_contains("No such file or directory");
|
||||
}
|
||||
|
||||
|
@ -88,20 +86,17 @@ fn test_stdbuf_invalid_mode_fails() {
|
|||
for option in &options {
|
||||
new_ucmd!()
|
||||
.args(&[*option, "1024R", "head"])
|
||||
.fails()
|
||||
.code_is(125)
|
||||
.fails_with_code(125)
|
||||
.usage_error("invalid mode '1024R': Value too large for defined data type");
|
||||
new_ucmd!()
|
||||
.args(&[*option, "1Y", "head"])
|
||||
.fails()
|
||||
.code_is(125)
|
||||
.fails_with_code(125)
|
||||
.stderr_contains("stdbuf: invalid mode '1Y': Value too large for defined data type");
|
||||
#[cfg(target_pointer_width = "32")]
|
||||
{
|
||||
new_ucmd!()
|
||||
.args(&[*option, "5GB", "head"])
|
||||
.fails()
|
||||
.code_is(125)
|
||||
.fails_with_code(125)
|
||||
.stderr_contains(
|
||||
"stdbuf: invalid mode '5GB': Value too large for defined data type",
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue