mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
Merge pull request #6690 from LoricAndre/main
fix: add arg count for cp
This commit is contained in:
@@ -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:");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user