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

tests: use CmdResult::usage_error

This commit is contained in:
Thomas Queiroz 2021-11-09 17:23:41 -03:00
parent f43dfa9a61
commit c9624725ab
No known key found for this signature in database
GPG key ID: 229D2DDF7ECA5F8F
9 changed files with 34 additions and 87 deletions

View file

@ -15,15 +15,10 @@ fn test_more_dir_arg() {
// Maybe we could capture the error, i.e. "Device not found" in that case
// but I am leaving this for later
if atty::is(atty::Stream::Stdout) {
let ts = TestScenario::new(util_name!());
let result = ts.ucmd().arg(".").run();
result.failure();
let expected_error_message = &format!(
"{0}: '.' is a directory.\nTry '{1} {0} --help' for more information.",
ts.util_name,
ts.bin_path.to_string_lossy()
);
assert_eq!(result.stderr_str().trim(), expected_error_message);
new_ucmd!()
.arg(".")
.fails()
.usage_error("'.' is a directory.");
} else {
}
}