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

ls: don't escape backslash in shell style quoting

This commit is contained in:
Terts Diepraam 2021-04-21 11:08:40 +02:00
parent ff620b5fa4
commit 795d89f11d
2 changed files with 41 additions and 2 deletions

View file

@ -1049,6 +1049,7 @@ fn test_ls_quoting_style() {
at.touch("one two");
at.touch("one");
at.touch("one\\two");
// It seems that windows doesn't allow \n in filenames.
#[cfg(unix)]
@ -1168,6 +1169,27 @@ fn test_ls_quoting_style() {
.succeeds()
.stdout_only(format!("{}\n", correct));
}
for (arg, correct) in &[
("--quoting-style=literal", "one\\two"),
("-N", "one\\two"),
("--quoting-style=c", "\"one\\\\two\""),
("-Q", "\"one\\\\two\""),
("--quote-name", "\"one\\\\two\""),
("--quoting-style=escape", "one\\\\two"),
("-b", "one\\\\two"),
("--quoting-style=shell-escape", "one\\two"),
("--quoting-style=shell-escape-always", "'one\\two'"),
("--quoting-style=shell", "one\\two"),
("--quoting-style=shell-always", "'one\\two'"),
] {
scene
.ucmd()
.arg(arg)
.arg("one\\two")
.succeeds()
.stdout_only(format!("{}\n", correct));
}
}
#[test]