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

Merge pull request #4260 from sbentmar/expand-fix-perl-failures

expand: improve plus specifier handling
This commit is contained in:
Sylvestre Ledru 2023-01-28 18:15:08 +01:00 committed by GitHub
commit efc70ade68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 106 additions and 14 deletions

View file

@ -298,3 +298,93 @@ fn test_tabs_and_tabs_shortcut_mixed() {
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_ignore_initial_plus() {
new_ucmd!()
.args(&["--tabs=+3"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_ignore_initial_pluses() {
new_ucmd!()
.args(&["--tabs=++3"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_ignore_initial_slash() {
new_ucmd!()
.args(&["--tabs=/3"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_ignore_initial_slashes() {
new_ucmd!()
.args(&["--tabs=//3"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_ignore_initial_plus_slash_combination() {
new_ucmd!()
.args(&["--tabs=+/3"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_comma_with_plus_1() {
new_ucmd!()
.args(&["--tabs=3,+6"])
.pipe_in("\t111\t222\t333")
.succeeds()
// 01234567890
.stdout_is(" 111 222 333");
}
#[test]
fn test_comma_with_plus_2() {
new_ucmd!()
.args(&["--tabs=1,+5"])
.pipe_in("\ta\tb\tc")
.succeeds()
// 01234567890
.stdout_is(" a b c");
}
#[test]
fn test_comma_with_plus_3() {
new_ucmd!()
.args(&["--tabs=2,+5"])
.pipe_in("a\tb\tc")
.succeeds()
// 01234567890
.stdout_is("a b c");
}
#[test]
fn test_comma_with_plus_4() {
new_ucmd!()
.args(&["--tabs=1,3,+5"])
.pipe_in("a\tb\tc")
.succeeds()
// 01234567890
.stdout_is("a b c");
}