mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
base32: move from getopts to clap
Note, I needed to change the error messages in one of the tests because getopt and clap have different error messages when not providing a default value
This commit is contained in:
parent
c3d7358df6
commit
5578ba6eed
5 changed files with 182 additions and 56 deletions
|
@ -71,8 +71,7 @@ fn test_wrap() {
|
|||
fn test_wrap_no_arg() {
|
||||
for wrap_param in vec!["-w", "--wrap"] {
|
||||
new_ucmd!().arg(wrap_param).fails().stderr_only(format!(
|
||||
"base32: error: Argument to option '{}' missing\n",
|
||||
if wrap_param == "-w" { "w" } else { "wrap" }
|
||||
"error: The argument '--wrap <wrap>\' requires a value but none was supplied\n\nUSAGE:\n base32 [OPTION]... [FILE]\n\nFor more information try --help"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -87,3 +86,21 @@ fn test_wrap_bad_arg() {
|
|||
.stderr_only("base32: error: invalid wrap size: ‘b’: invalid digit found in string\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_base32_extra_operand() {
|
||||
// Expect a failure when multiple files are specified.
|
||||
new_ucmd!()
|
||||
.arg("a.txt")
|
||||
.arg("a.txt")
|
||||
.fails()
|
||||
.stderr_only("base32: error: extra operand ‘a.txt’");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_base32_file_not_found() {
|
||||
new_ucmd!()
|
||||
.arg("a.txt")
|
||||
.fails()
|
||||
.stderr_only("base32: error: a.txt: No such file or directory");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue