1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 03:36:18 +00:00

Merge pull request #3595 from cakebaker/specifier_only_allowed_with_last_value

expand: allow specifier only with last value
This commit is contained in:
Sylvestre Ledru 2022-06-07 15:06:40 +02:00 committed by GitHub
commit d7b7b7f8c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 39 additions and 0 deletions

View file

@ -226,6 +226,24 @@ fn test_tabs_with_specifier_not_at_start() {
run_cmd("--tabs=1+2", "+", "+2");
}
#[test]
fn test_tabs_with_specifier_only_allowed_with_last_value() {
fn run_cmd(arg: &str, specifier: &str) {
let expected_msg = format!(
"{} specifier only allowed with the last value",
specifier.quote()
);
new_ucmd!().arg(arg).fails().stderr_contains(expected_msg);
}
run_cmd("--tabs=/1,2,3", "/");
run_cmd("--tabs=1,/2,3", "/");
new_ucmd!().arg("--tabs=1,2,/3").succeeds();
run_cmd("--tabs=+1,2,3", "+");
run_cmd("--tabs=1,+2,3", "+");
new_ucmd!().arg("--tabs=1,2,+3").succeeds();
}
#[test]
fn test_tabs_with_invalid_chars() {
new_ucmd!()