mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
Merge pull request #6690 from LoricAndre/main
fix: add arg count for cp
This commit is contained in:
commit
ac6b115bad
2 changed files with 19 additions and 0 deletions
|
@ -677,6 +677,8 @@ pub fn uu_app() -> Command {
|
|||
.arg(
|
||||
Arg::new(options::PATHS)
|
||||
.action(ArgAction::Append)
|
||||
.num_args(1..)
|
||||
.required(true)
|
||||
.value_hint(clap::ValueHint::AnyPath)
|
||||
.value_parser(ValueParser::os_string()),
|
||||
)
|
||||
|
|
|
@ -5751,3 +5751,20 @@ fn test_cp_with_options_backup_and_rem_when_dest_is_symlink() {
|
|||
assert!(!at.symlink_exists("inner_dir/sl"));
|
||||
assert_eq!(at.read("inner_dir/sl"), "xyz");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_single_file() {
|
||||
let (_at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.arg(TEST_HELLO_WORLD_SOURCE)
|
||||
.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains("missing destination file");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_no_file() {
|
||||
let (_at, mut ucmd) = at_and_ucmd!();
|
||||
ucmd.fails()
|
||||
.code_is(1)
|
||||
.stderr_contains("error: the following required arguments were not provided:");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue