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

expand: allow specifier only with last value

This commit is contained in:
Daniel Hofstetter 2022-06-05 15:16:48 +02:00
parent fc5aedfbb7
commit 804240164b
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!()