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

cp: move option check to uumain and use show_usage_error

- add test for conflicting options `--backup` and `--no-clobber`
This commit is contained in:
Matt Blessed 2021-05-26 10:50:41 -04:00
parent a8a1ec7faf
commit 25ed5eeb0e
2 changed files with 18 additions and 11 deletions

View file

@ -539,6 +539,18 @@ fn test_cp_backup_off() {
assert!(!at.file_exists(&format!("{}~", TEST_HOW_ARE_YOU_SOURCE)));
}
#[test]
fn test_cp_backup_no_clobber_conflicting_options() {
let (_, mut ucmd) = at_and_ucmd!();
ucmd.arg("--backup")
.arg("--no-clobber")
.arg(TEST_HELLO_WORLD_SOURCE)
.arg(TEST_HOW_ARE_YOU_SOURCE)
.fails()
.stderr_is("cp: options --backup and --no-clobber are mutually exclusive\nTry 'cp --help' for more information.");
}
#[test]
fn test_cp_deref_conflicting_options() {
new_ucmd!()