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

cut: allow non utf8 characters for delimiters (#6037)

This commit is contained in:
Yury Zhytkou 2024-03-10 17:36:17 -04:00 committed by GitHub
parent da9682da7a
commit 156d3f7ee7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 175 additions and 117 deletions

View file

@ -288,3 +288,17 @@ fn test_multiple_mode_args() {
.stderr_is("cut: invalid usage: expects no more than one of --fields (-f), --chars (-c) or --bytes (-b)\n");
}
}
#[test]
#[cfg(unix)]
fn test_8bit_non_utf8_delimiter() {
use std::ffi::OsStr;
use std::os::unix::ffi::OsStrExt;
let delim = OsStr::from_bytes(b"\xAD".as_slice());
new_ucmd!()
.arg("-d")
.arg(delim)
.args(&["--out=_", "-f2,3", "8bit-delim.txt"])
.succeeds()
.stdout_check(|out| out == "b_c\n".as_bytes());
}