Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions tests/by-util/test_csplit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1412,9 +1412,8 @@ fn repeat_everything() {
"9",
"{5}",
])
.fails()
.fails_with_code(1)
.no_stdout()
.code_is(1)
.stderr_only("csplit: '9': line number out of range on repetition 5\n");
let count = glob(&at.plus_as_string("xx*"))
.expect("there should be some splits created")
Expand Down
4 changes: 2 additions & 2 deletions tests/by-util/test_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ fn test_invalid_arg() {

#[test]
fn test_valid_arg_exponents() {
new_ucmd!().arg("-h").succeeds().code_is(0);
new_ucmd!().arg("--exponents").succeeds().code_is(0);
new_ucmd!().arg("-h").succeeds();
new_ucmd!().arg("--exponents").succeeds();
}

#[test]
Expand Down
12 changes: 4 additions & 8 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ fn test_invalid_value_time_style() {
new_ucmd!()
.arg("--time-style=definitely_invalid_value")
.succeeds()
.no_stderr()
.code_is(0);
.no_stderr();
// If it is used, error:
new_ucmd!()
.arg("-g")
Expand All @@ -112,8 +111,7 @@ fn test_invalid_value_time_style() {
.arg("--time-style=definitely_invalid_value")
.arg("--format=single-column")
.succeeds()
.no_stderr()
.code_is(0);
.no_stderr();
}

#[test]
Expand Down Expand Up @@ -4110,8 +4108,7 @@ fn test_ls_dangling_symlinks() {
// Check padding is the same for real files and dangling links, in non-long formats
at.touch("temp_dir/real_file");

let real_file_res = scene.ucmd().arg("-Li1").arg("temp_dir").fails();
real_file_res.code_is(1);
let real_file_res = scene.ucmd().arg("-Li1").arg("temp_dir").fails_with_code(1);
let real_file_stdout_len = String::from_utf8(real_file_res.stdout().to_owned())
.ok()
.unwrap()
Expand All @@ -4122,8 +4119,7 @@ fn test_ls_dangling_symlinks() {
.unwrap()
.len();

let dangle_file_res = scene.ucmd().arg("-Li1").arg("temp_dir").fails();
dangle_file_res.code_is(1);
let dangle_file_res = scene.ucmd().arg("-Li1").arg("temp_dir").fails_with_code(1);
let dangle_stdout_len = String::from_utf8(dangle_file_res.stdout().to_owned())
.ok()
.unwrap()
Expand Down
55 changes: 22 additions & 33 deletions tests/by-util/test_tail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,9 @@ fn test_follow_stdin_name_retry() {
for _ in 0..2 {
new_ucmd!()
.args(&args)
.run()
.fails_with_code(1)
.no_stdout()
.stderr_is("tail: cannot follow '-' by name\n")
.code_is(1);
.stderr_is("tail: cannot follow '-' by name\n");
args.pop();
}
}
Expand Down Expand Up @@ -852,13 +851,12 @@ fn test_follow_missing() {
new_ucmd!()
.arg(follow_mode)
.arg("missing")
.run()
.fails_with_code(1)
.no_stdout()
.stderr_is(
"tail: cannot open 'missing' for reading: No such file or directory\n\
tail: no files remaining\n",
)
.code_is(1);
);
}
}

Expand All @@ -871,17 +869,15 @@ fn test_follow_name_stdin() {
ts.ucmd()
.arg("--follow=name")
.arg("-")
.run()
.stderr_is("tail: cannot follow '-' by name\n")
.code_is(1);
.fails_with_code(1)
.stderr_is("tail: cannot follow '-' by name\n");
ts.ucmd()
.arg("--follow=name")
.arg("FILE1")
.arg("-")
.arg("FILE2")
.run()
.stderr_is("tail: cannot follow '-' by name\n")
.code_is(1);
.fails_with_code(1)
.stderr_is("tail: cannot follow '-' by name\n");
}

#[test]
Expand Down Expand Up @@ -910,9 +906,8 @@ fn test_dir() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("DIR");
ucmd.arg("DIR")
.run()
.stderr_is("tail: error reading 'DIR': Is a directory\n")
.code_is(1);
.fails_with_code(1)
.stderr_is("tail: error reading 'DIR': Is a directory\n");
}

#[test]
Expand All @@ -924,14 +919,13 @@ fn test_dir_follow() {
ts.ucmd()
.arg(mode)
.arg("DIR")
.run()
.fails_with_code(1)
.no_stdout()
.stderr_is(
"tail: error reading 'DIR': Is a directory\n\
tail: DIR: cannot follow end of this type of file; giving up on this name\n\
tail: no files remaining\n",
)
.code_is(1);
);
}
}

Expand All @@ -944,14 +938,13 @@ fn test_dir_follow_retry() {
.arg("--follow=descriptor")
.arg("--retry")
.arg("DIR")
.run()
.fails_with_code(1)
.stderr_is(
"tail: warning: --retry only effective for the initial open\n\
tail: error reading 'DIR': Is a directory\n\
tail: DIR: cannot follow end of this type of file\n\
tail: no files remaining\n",
)
.code_is(1);
);
}

#[test]
Expand Down Expand Up @@ -1161,12 +1154,11 @@ fn test_bytes_for_funny_unix_files() {
continue;
}
let args = ["--bytes", "1", file];
let result = ts.ucmd().args(&args).run();
let exp_result = unwrap_or_return!(expected_result(&ts, &args));
let result = ts.ucmd().args(&args).succeeds();
result
.stdout_is(exp_result.stdout_str())
.stderr_is(exp_result.stderr_str())
.code_is(exp_result.code());
.stderr_is(exp_result.stderr_str());
}
}

Expand Down Expand Up @@ -1194,13 +1186,11 @@ fn test_retry2() {
let ts = TestScenario::new(util_name!());
let missing = "missing";

let result = ts.ucmd().arg(missing).arg("--retry").run();
result
.stderr_is(
"tail: warning: --retry ignored; --retry is useful only when following\n\
let result = ts.ucmd().arg(missing).arg("--retry").fails_with_code(1);
result.stderr_is(
"tail: warning: --retry ignored; --retry is useful only when following\n\
tail: cannot open 'missing' for reading: No such file or directory\n",
)
.code_is(1);
);
}

#[test]
Expand Down Expand Up @@ -4485,9 +4475,8 @@ fn test_follow_when_files_are_pointing_to_same_relative_file_and_file_stays_same
fn test_args_sleep_interval_when_illegal_argument_then_usage_error(#[case] sleep_interval: &str) {
new_ucmd!()
.args(&["--sleep-interval", sleep_interval])
.run()
.usage_error(format!("invalid number of seconds: '{sleep_interval}'"))
.code_is(1);
.fails_with_code(1)
.usage_error(format!("invalid number of seconds: '{sleep_interval}'"));
}

#[test]
Expand Down
Loading
Loading