mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
join: implement the -t option
This commit is contained in:
parent
c27edbb73f
commit
4e0a0cf7bb
5 changed files with 110 additions and 45 deletions
6
tests/fixtures/join/semicolon_fields_1.txt
vendored
Normal file
6
tests/fixtures/join/semicolon_fields_1.txt
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
1; a
|
||||
2 ;b
|
||||
3; c
|
||||
4 ;d
|
||||
5; e
|
||||
6 ;f
|
3
tests/fixtures/join/semicolon_fields_2.txt
vendored
Normal file
3
tests/fixtures/join/semicolon_fields_2.txt
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
2 ;x
|
||||
3; y
|
||||
4 ;z
|
4
tests/fixtures/join/semicolon_separated.expected
vendored
Normal file
4
tests/fixtures/join/semicolon_separated.expected
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
2 ;b;x
|
||||
3; c; y
|
||||
4 ;d;z
|
||||
|
|
@ -93,3 +93,34 @@ fn case_insensitive() {
|
|||
.arg("-i")
|
||||
.succeeds().stdout_only_fixture("case_insensitive.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn semicolon_separated() {
|
||||
new_ucmd!()
|
||||
.arg("semicolon_fields_1.txt")
|
||||
.arg("semicolon_fields_2.txt")
|
||||
.arg("-t")
|
||||
.arg(";")
|
||||
.succeeds().stdout_only_fixture("semicolon_separated.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn new_line_separated() {
|
||||
new_ucmd!()
|
||||
.arg("-")
|
||||
.arg("fields_2.txt")
|
||||
.arg("-t")
|
||||
.arg("")
|
||||
.pipe_in("1 a\n1 b\n8 h\n")
|
||||
.succeeds().stdout_only("1 a\n8 h");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn multitab_character() {
|
||||
new_ucmd!()
|
||||
.arg("semicolon_fields_1.txt")
|
||||
.arg("semicolon_fields_2.txt")
|
||||
.arg("-t")
|
||||
.arg("э")
|
||||
.fails().stderr_is("join: error: multi-character tab э");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue