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

Merge pull request #2881 from jtracey/join-null-field-sep

join: add support for `-t '\0'`
This commit is contained in:
Sylvestre Ledru 2022-01-29 10:55:04 +01:00 committed by GitHub
commit 52ab6325a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 0 deletions

View file

@ -537,6 +537,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
settings.separator = match value.len() {
0 => Sep::Line,
1 => Sep::Char(value[0]),
2 if value[0] == b'\\' && value[1] == b'0' => Sep::Char(0),
_ => {
return Err(USimpleError::new(
1,

View file

@ -366,6 +366,17 @@ fn non_unicode() {
.stdout_only_fixture("non-unicode.expected");
}
#[test]
fn null_field_separators() {
new_ucmd!()
.arg("-t")
.arg("\\0")
.arg("non-unicode_1.bin")
.arg("non-unicode_2.bin")
.succeeds()
.stdout_only_fixture("null-sep.expected");
}
#[test]
fn null_line_endings() {
new_ucmd!()

BIN
tests/fixtures/join/null-sep.expected vendored Normal file

Binary file not shown.