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

cut: fix argument parsing for the delimiter

This fixes the argument parsing for the delimiter for the two special
cases `-d=` and `-d ''`.
This commit is contained in:
Jan Scheer 2022-06-09 22:14:43 +02:00
parent 95de5f6494
commit fa64407cb0
No known key found for this signature in database
GPG key ID: C62AD4C29E2B9828
2 changed files with 24 additions and 5 deletions

View file

@ -172,10 +172,28 @@ fn test_directory_and_no_such_file() {
}
#[test]
fn test_equal_as_delimiter() {
fn test_equal_as_delimiter1() {
new_ucmd!()
.args(&["-f", "2", "-d="])
.pipe_in("--dir=./out/lib")
.succeeds()
.stdout_only("./out/lib\n");
}
#[test]
fn test_equal_as_delimiter2() {
new_ucmd!()
.args(&["-f2", "--delimiter="])
.pipe_in("a=b\n")
.succeeds()
.stdout_only("a=b\n");
}
#[test]
fn test_equal_as_delimiter3() {
new_ucmd!()
.args(&["-f", "1,2", "-d", "''", "--output-delimiter=Z"])
.pipe_in("ab\0cd\n")
.succeeds()
.stdout_only_bytes("abZcd\n");
}