1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Fix tr argument handling for missing arguments (#1601)

* tests/tr ~ confirm failure for missing argument(s)

* fix/tr ~ mimic GNU error reponse for missing argument(s)
This commit is contained in:
Roy Ivy III 2020-10-02 15:43:57 -05:00 committed by GitHub
parent 9a1c560aba
commit 0fa249a944
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 5 deletions

View file

@ -116,3 +116,23 @@ fn test_truncate_with_set1_shorter_than_set2() {
.run()
.stdout_is("xycde");
}
#[test]
fn missing_args_fails() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd.run();
assert!(!result.success);
assert!(result.stderr.contains("missing operand"));
}
#[test]
fn missing_required_second_arg_fails() {
let (_, mut ucmd) = at_and_ucmd!();
let result = ucmd
.args(&["foo"])
.run();
assert!(!result.success);
assert!(result.stderr.contains("missing operand after"));
}