mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
ls: Fix --{show, hide}-control-chars logic
This commit is contained in:
parent
a93959aa44
commit
4d6faae555
2 changed files with 9 additions and 20 deletions
|
@ -1416,6 +1416,7 @@ fn test_ls_quoting_style() {
|
|||
// Default is shell-escape
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--hide-control-chars")
|
||||
.arg("one\ntwo")
|
||||
.succeeds()
|
||||
.stdout_only("'one'$'\\n''two'\n");
|
||||
|
@ -1437,23 +1438,8 @@ fn test_ls_quoting_style() {
|
|||
] {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg(arg)
|
||||
.arg("one\ntwo")
|
||||
.succeeds()
|
||||
.stdout_only(format!("{}\n", correct));
|
||||
}
|
||||
|
||||
for (arg, correct) in &[
|
||||
("--quoting-style=literal", "one?two"),
|
||||
("-N", "one?two"),
|
||||
("--literal", "one?two"),
|
||||
("--quoting-style=shell", "one?two"),
|
||||
("--quoting-style=shell-always", "'one?two'"),
|
||||
] {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg(arg)
|
||||
.arg("--hide-control-chars")
|
||||
.arg(arg)
|
||||
.arg("one\ntwo")
|
||||
.succeeds()
|
||||
.stdout_only(format!("{}\n", correct));
|
||||
|
@ -1463,7 +1449,7 @@ fn test_ls_quoting_style() {
|
|||
("--quoting-style=literal", "one\ntwo"),
|
||||
("-N", "one\ntwo"),
|
||||
("--literal", "one\ntwo"),
|
||||
("--quoting-style=shell", "one\ntwo"),
|
||||
("--quoting-style=shell", "one\ntwo"), // FIXME: GNU ls quotes this case
|
||||
("--quoting-style=shell-always", "'one\ntwo'"),
|
||||
] {
|
||||
scene
|
||||
|
@ -1490,6 +1476,7 @@ fn test_ls_quoting_style() {
|
|||
] {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--hide-control-chars")
|
||||
.arg(arg)
|
||||
.arg("one\\two")
|
||||
.succeeds()
|
||||
|
@ -1505,6 +1492,7 @@ fn test_ls_quoting_style() {
|
|||
] {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--hide-control-chars")
|
||||
.arg(arg)
|
||||
.arg("one\n&two")
|
||||
.succeeds()
|
||||
|
@ -1535,6 +1523,7 @@ fn test_ls_quoting_style() {
|
|||
] {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--hide-control-chars")
|
||||
.arg(arg)
|
||||
.arg("one two")
|
||||
.succeeds()
|
||||
|
@ -1558,6 +1547,7 @@ fn test_ls_quoting_style() {
|
|||
] {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--hide-control-chars")
|
||||
.arg(arg)
|
||||
.arg("one")
|
||||
.succeeds()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue