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

Merge pull request #4232 from TechHara/whitespace

cut: add whitespace option for separating fields
This commit is contained in:
Terts Diepraam 2023-01-01 12:58:28 +01:00 committed by GitHub
commit 36f3507bed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 310 additions and 45 deletions

View file

@ -81,6 +81,38 @@ fn test_field_sequence() {
}
}
#[test]
fn test_whitespace_delimited() {
new_ucmd!()
.args(&["-w", "-f", COMPLEX_SEQUENCE.sequence, INPUT])
.succeeds()
.stdout_only_fixture("whitespace_delimited.expected");
}
#[test]
fn test_whitespace_with_explicit_delimiter() {
new_ucmd!()
.args(&["-w", "-f", COMPLEX_SEQUENCE.sequence, "-d:"])
.fails()
.code_is(1);
}
#[test]
fn test_whitespace_with_byte() {
new_ucmd!()
.args(&["-w", "-b", COMPLEX_SEQUENCE.sequence])
.fails()
.code_is(1);
}
#[test]
fn test_whitespace_with_char() {
new_ucmd!()
.args(&["-c", COMPLEX_SEQUENCE.sequence, "-w"])
.fails()
.code_is(1);
}
#[test]
fn test_specify_delimiter() {
for param in ["-d", "--delimiter", "--del"] {

View file

@ -0,0 +1,5 @@
foo:bar:baz:qux:quux
one:two:three:four:five:six:seven
alpha:beta:gamma:delta:epsilon:zeta:eta:theta:iota:kappa:lambda:mu
the quick fox over the dog
sally sells down the seashore are the seashells sally sells