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

paste: handle list ending with unescaped backslash

This commit is contained in:
Daniel Hofstetter 2022-06-22 09:37:16 +02:00
parent b33986de86
commit c254900db9
2 changed files with 42 additions and 3 deletions

View file

@ -156,6 +156,37 @@ fn test_multi_stdin() {
}
}
#[test]
fn test_delimiter_list_ending_with_escaped_backslash() {
for d in ["-d", "--delimiters"] {
let (at, mut ucmd) = at_and_ucmd!();
let mut ins = vec![];
for (i, _in) in ["a\n", "b\n"].iter().enumerate() {
let file = format!("in{}", i);
at.write(&file, _in);
ins.push(file);
}
ucmd.args(&[d, "\\\\"])
.args(&ins)
.succeeds()
.stdout_is("a\\b\n");
}
}
#[test]
fn test_delimiter_list_ending_with_unescaped_backslash() {
for d in ["-d", "--delimiters"] {
new_ucmd!()
.args(&[d, "\\"])
.fails()
.stderr_contains("delimiter list ends with an unescaped backslash: \\");
new_ucmd!()
.args(&[d, "_\\"])
.fails()
.stderr_contains("delimiter list ends with an unescaped backslash: _\\");
}
}
#[test]
fn test_data() {
for example in EXAMPLE_DATA {