diff --git a/tests/by-util/test_join.rs b/tests/by-util/test_join.rs index 955f21d68b..e25f84b64b 100644 --- a/tests/by-util/test_join.rs +++ b/tests/by-util/test_join.rs @@ -208,9 +208,9 @@ fn tab_multi_character() { .arg("semicolon_fields_1.txt") .arg("semicolon_fields_2.txt") .arg("-t") - .arg("э") + .arg("ab") .fails() - .stderr_is("join: multi-character tab э\n"); + .stderr_is("join: multi-character tab ab\n"); } #[test] @@ -437,14 +437,22 @@ fn non_unicode() { #[cfg(unix)] { - let invalid_utf8: u8 = 167; + let non_utf8_byte: u8 = 167; new_ucmd!() .arg("-t") - .arg(OsStr::from_bytes(&[invalid_utf8])) + .arg(OsStr::from_bytes(&[non_utf8_byte])) .arg("non-unicode_1.bin") .arg("non-unicode_2.bin") .succeeds() .stdout_only_fixture("non-unicode_sep.expected"); + + new_ucmd!() + .arg("-t") + .arg(OsStr::from_bytes(&[non_utf8_byte, non_utf8_byte])) + .arg("non-unicode_1.bin") + .arg("non-unicode_2.bin") + .fails() + .stderr_is("join: non-UTF-8 multi-byte tab\n"); } #[cfg(windows)] @@ -462,6 +470,16 @@ fn non_unicode() { } } +#[test] +fn multibyte_sep() { + new_ucmd!() + .arg("-t§") + .arg("multibyte_sep_1.txt") + .arg("multibyte_sep_2.txt") + .succeeds() + .stdout_only_fixture("multibyte_sep.expected"); +} + #[test] fn null_field_separators() { new_ucmd!() diff --git a/tests/fixtures/join/multibyte_sep.expected b/tests/fixtures/join/multibyte_sep.expected new file mode 100644 index 0000000000..c8a6aacfd1 --- /dev/null +++ b/tests/fixtures/join/multibyte_sep.expected @@ -0,0 +1 @@ +a§b§c diff --git a/tests/fixtures/join/multibyte_sep_1.txt b/tests/fixtures/join/multibyte_sep_1.txt new file mode 100644 index 0000000000..a42f9eefae --- /dev/null +++ b/tests/fixtures/join/multibyte_sep_1.txt @@ -0,0 +1 @@ +a§b diff --git a/tests/fixtures/join/multibyte_sep_2.txt b/tests/fixtures/join/multibyte_sep_2.txt new file mode 100644 index 0000000000..81288ad520 --- /dev/null +++ b/tests/fixtures/join/multibyte_sep_2.txt @@ -0,0 +1 @@ +a§c