1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

tests: adapt to clap's modified error messages

This commit is contained in:
Daniel Hofstetter 2023-03-08 15:06:07 +01:00
parent 817a832f33
commit 3eeb5dda30
13 changed files with 17 additions and 25 deletions

View file

@ -86,7 +86,7 @@ fn test_wrap() {
fn test_wrap_no_arg() {
for wrap_param in ["-w", "--wrap"] {
let ts = TestScenario::new(util_name!());
let expected_stderr = "The argument '--wrap <COLS>' requires a value but none was supplied";
let expected_stderr = "a value is required for '--wrap <COLS>' but none was supplied";
ts.ucmd()
.arg(wrap_param)
.fails()

View file

@ -79,7 +79,7 @@ fn test_wrap_no_arg() {
new_ucmd!()
.arg(wrap_param)
.fails()
.stderr_contains("The argument '--wrap <COLS>' requires a value but none was supplied")
.stderr_contains("a value is required for '--wrap <COLS>' but none was supplied")
.no_stdout();
}
}

View file

@ -196,7 +196,7 @@ fn test_missing_files() {
.arg("groupname")
.fails()
.stderr_contains(
"error: The following required arguments were not provided:\n <FILE>...\n",
"error: the following required arguments were not provided:\n <FILE>...\n",
);
}

View file

@ -15,7 +15,7 @@ fn test_missing_operand() {
assert!(result
.stderr_str()
.starts_with("error: The following required arguments were not provided"));
.starts_with("error: the following required arguments were not provided"));
assert!(result.stderr_str().contains("<newroot>"));
}

View file

@ -1495,7 +1495,7 @@ fn test_cp_reflink_bad() {
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_EXISTING_FILE)
.fails()
.stderr_contains("error: 'bad' isn't a valid value for '--reflink[=<WHEN>]'");
.stderr_contains("error: invalid value 'bad' for '--reflink[=<WHEN>]'");
}
#[test]

View file

@ -52,7 +52,7 @@ fn test_link_one_argument() {
let file = "test_link_argument";
ucmd.args(&[file])
.fails()
.stderr_contains("requires 2 values");
.stderr_contains("2 values required");
}
#[test]
@ -65,5 +65,5 @@ fn test_link_three_arguments() {
];
ucmd.args(&arguments[..])
.fails()
.stderr_contains("requires 2 values");
.stderr_contains("2 values required");
}

View file

@ -92,14 +92,14 @@ fn test_mknod_character_device_requires_major_and_minor() {
.arg("1")
.arg("c")
.fails()
.stderr_contains("Invalid value 'c'");
.stderr_contains("invalid value 'c'");
new_ucmd!()
.arg("test_file")
.arg("c")
.arg("c")
.arg("1")
.fails()
.stderr_contains("Invalid value 'c'");
.stderr_contains("invalid value 'c'");
}
#[test]
@ -109,7 +109,7 @@ fn test_mknod_invalid_arg() {
.arg("--foo")
.fails()
.no_stdout()
.stderr_contains("Found argument '--foo' which wasn't expected");
.stderr_contains("unexpected argument '--foo' found");
}
#[test]

View file

@ -36,18 +36,12 @@ fn test_hex_rejects_sign_after_identifier() {
.args(&["-0x-123ABC"])
.fails()
.no_stdout()
.stderr_contains(
"Found argument '-0' which wasn't expected, or isn't valid in this context",
)
.stderr_contains("For more information try '--help'");
.stderr_contains("unexpected argument '-0' found");
new_ucmd!()
.args(&["-0x+123ABC"])
.fails()
.no_stdout()
.stderr_contains(
"Found argument '-0' which wasn't expected, or isn't valid in this context",
)
.stderr_contains("For more information try '--help'");
.stderr_contains("unexpected argument '-0' found");
}
#[test]

View file

@ -999,7 +999,7 @@ fn test_conflict_check_out() {
.fails()
.stderr_contains(
// the rest of the message might be subject to change
"error: The argument",
"error: the argument",
);
}
}

View file

@ -30,7 +30,7 @@ fn test_stdbuf_no_buffer_option_fails() {
ts.ucmd()
.args(&["head"])
.fails()
.stderr_contains("The following required arguments were not provided:");
.stderr_contains("the following required arguments were not provided:");
}
#[cfg(not(target_os = "windows"))]

View file

@ -194,7 +194,7 @@ fn test_error_filename_only() {
.args(&["file"])
.fails()
.code_is(1)
.stderr_contains("error: The following required arguments were not provided:");
.stderr_contains("error: the following required arguments were not provided:");
}
#[test]

View file

@ -50,7 +50,5 @@ fn test_multiple_arguments() {
.arg("call_graph.txt")
.arg("invalid_file")
.fails()
.stderr_contains(
"Found argument 'invalid_file' which wasn't expected, or isn't valid in this context",
);
.stderr_contains("unexpected argument 'invalid_file' found");
}

View file

@ -151,7 +151,7 @@ fn test_arg1_arg2() {
#[test]
fn test_too_many_args() {
const EXPECTED: &str =
"error: The value 'u' was provided to '[FILE]...' but it wasn't expecting any more values";
"error: unexpected value 'u' for '[FILE]...' found; no more were expected";
let args = ["am", "i", "u"];
new_ucmd!().args(&args).fails().stderr_contains(EXPECTED);