mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Test for unimplemented command line arguments
We check if the user has given one of the (many) not yet implemented command line arguments. Upon catching this, we display the specific transgressor to stderr and exit with return code 2. This behaviour is tested in one new integration test.
This commit is contained in:
parent
8a5719561d
commit
a5d97323db
2 changed files with 65 additions and 3 deletions
|
@ -17,13 +17,13 @@ fn test_install_help() {
|
|||
assert_empty_stderr!(result);
|
||||
assert!(result.success);
|
||||
|
||||
// assert!(result.stdout.contains("Usage:"));
|
||||
assert!(result.stdout.contains("Usage:"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_install_basic() {
|
||||
let (at, mut ucmd) = testing(UTIL_NAME);
|
||||
let dir = "test_install_target_dir_dir";
|
||||
let dir = "test_install_target_dir_dir_a";
|
||||
let file = "test_install_target_dir_file_a";
|
||||
|
||||
at.touch(file);
|
||||
|
@ -36,3 +36,20 @@ fn test_install_basic() {
|
|||
assert!(!at.file_exists(file));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file)));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_install_unimplemented_arg() {
|
||||
let (at, mut ucmd) = testing(UTIL_NAME);
|
||||
let dir = "test_install_target_dir_dir_b";
|
||||
let file = "test_install_target_dir_file_b";
|
||||
let context_arg = "--context";
|
||||
|
||||
at.touch(file);
|
||||
at.mkdir(dir);
|
||||
let result = ucmd.arg(context_arg).arg(file).arg(dir).run();
|
||||
|
||||
assert!(!result.success);
|
||||
assert!(result.stderr.contains("Unimplemented"));
|
||||
|
||||
assert!(!at.file_exists(&format!("{}/{}", dir, file)));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue