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

Merge pull request #2163 from deantvv/test-link-arguments

Add tests to check link fails with 1 or 3 argument(s)
This commit is contained in:
Sylvestre Ledru 2021-05-02 17:17:10 +02:00 committed by GitHub
commit cd9e3e14e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -39,3 +39,25 @@ fn test_link_nonexistent_file() {
assert!(!at.file_exists(file)); assert!(!at.file_exists(file));
assert!(!at.file_exists(link)); assert!(!at.file_exists(link));
} }
#[test]
fn test_link_one_argument() {
let (_, mut ucmd) = at_and_ucmd!();
let file = "test_link_argument";
ucmd.args(&[file]).fails().stderr_contains(
"error: The argument '<FILES>...' requires at least 2 values, but only 1 was provide",
);
}
#[test]
fn test_link_three_arguments() {
let (_, mut ucmd) = at_and_ucmd!();
let arguments = vec![
"test_link_argument1",
"test_link_argument2",
"test_link_argument3",
];
ucmd.args(&arguments[..]).fails().stderr_contains(
format!("error: The value '{}' was provided to '<FILES>...', but it wasn't expecting any more values", arguments[2]),
);
}