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
|
@ -7,7 +7,7 @@ use crate::common::util::TestScenario;
|
|||
|
||||
#[test]
|
||||
fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(125);
|
||||
new_ucmd!().arg("--definitely-invalid").fails_with_code(125);
|
||||
}
|
||||
|
||||
// FIXME: this depends on the system having true and false in PATH
|
||||
|
@ -24,8 +24,7 @@ fn test_subcommand_return_code() {
|
|||
fn test_invalid_time_interval() {
|
||||
new_ucmd!()
|
||||
.args(&["xyz", "sleep", "0"])
|
||||
.fails()
|
||||
.code_is(125)
|
||||
.fails_with_code(125)
|
||||
.usage_error("invalid time interval 'xyz'");
|
||||
}
|
||||
|
||||
|
@ -33,8 +32,7 @@ fn test_invalid_time_interval() {
|
|||
fn test_invalid_kill_after() {
|
||||
new_ucmd!()
|
||||
.args(&["-k", "xyz", "1", "sleep", "0"])
|
||||
.fails()
|
||||
.code_is(125)
|
||||
.fails_with_code(125)
|
||||
.usage_error("invalid time interval 'xyz'");
|
||||
}
|
||||
|
||||
|
@ -85,8 +83,7 @@ fn test_foreground() {
|
|||
for arg in ["-f", "--foreground"] {
|
||||
new_ucmd!()
|
||||
.args(&[arg, ".1", "sleep", "10"])
|
||||
.fails()
|
||||
.code_is(124)
|
||||
.fails_with_code(124)
|
||||
.no_output();
|
||||
}
|
||||
}
|
||||
|
@ -173,8 +170,7 @@ fn test_kill_subprocess() {
|
|||
"-c",
|
||||
"trap 'echo inside_trap' TERM; sleep 30",
|
||||
])
|
||||
.fails()
|
||||
.code_is(124)
|
||||
.fails_with_code(124)
|
||||
.stdout_contains("inside_trap")
|
||||
.stderr_contains("Terminated");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue