mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
tests: replace run() with succeeds() or fails()
This commit is contained in:
parent
3844a74c38
commit
df4dfea852
39 changed files with 434 additions and 498 deletions
|
@ -11,7 +11,7 @@ fn test_get_current_niceness() {
|
|||
// Test that the nice command with no arguments returns the default nice
|
||||
// value, which we determine by querying libc's `nice` in our own process.
|
||||
new_ucmd!()
|
||||
.run()
|
||||
.succeeds()
|
||||
.stdout_is(format!("{}\n", unsafe { libc::nice(0) }));
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ fn test_negative_adjustment() {
|
|||
// the OS. If it gets denied, then we know a negative value was parsed
|
||||
// correctly.
|
||||
|
||||
let res = new_ucmd!().args(&["-n", "-1", "true"]).run();
|
||||
let res = new_ucmd!().args(&["-n", "-1", "true"]).succeeds();
|
||||
assert!(res
|
||||
.stderr_str()
|
||||
.starts_with("nice: warning: setpriority: Permission denied")); // spell-checker:disable-line
|
||||
|
@ -39,14 +39,14 @@ fn test_adjustment_with_no_command_should_error() {
|
|||
|
||||
#[test]
|
||||
fn test_command_with_no_adjustment() {
|
||||
new_ucmd!().args(&["echo", "a"]).run().stdout_is("a\n");
|
||||
new_ucmd!().args(&["echo", "a"]).succeeds().stdout_is("a\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_command_with_no_args() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "19", "echo"])
|
||||
.run()
|
||||
.succeeds()
|
||||
.stdout_is("\n");
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ fn test_command_with_no_args() {
|
|||
fn test_command_with_args() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "19", "echo", "a", "b", "c"])
|
||||
.run()
|
||||
.succeeds()
|
||||
.stdout_is("a b c\n");
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ fn test_command_with_args() {
|
|||
fn test_command_where_command_takes_n_flag() {
|
||||
new_ucmd!()
|
||||
.args(&["-n", "19", "echo", "-n", "a"])
|
||||
.run()
|
||||
.succeeds()
|
||||
.stdout_is("a");
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ fn test_invalid_argument() {
|
|||
fn test_bare_adjustment() {
|
||||
new_ucmd!()
|
||||
.args(&["-1", "echo", "-n", "a"])
|
||||
.run()
|
||||
.succeeds()
|
||||
.stdout_is("a");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue