mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
ls: set default quoting style to literal when not TTY (#5553)
* ls: set default quoting style to literal if output is not TTY * tests/ls: Fix quoting tests that now run with Literal as default * ls: Fix formatting/linting/spelling issues * tests/ls: Fix windows escaped tests
This commit is contained in:
parent
7333573361
commit
673093f842
2 changed files with 16 additions and 10 deletions
|
@ -2472,13 +2472,16 @@ fn test_ls_quoting_style() {
|
|||
{
|
||||
at.touch("one\ntwo");
|
||||
at.touch("one\\two");
|
||||
// Default is shell-escape
|
||||
// Default is literal, when stdout is not a TTY.
|
||||
// Otherwise, it is shell-escape
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("--hide-control-chars")
|
||||
.arg("one\ntwo")
|
||||
.succeeds()
|
||||
.stdout_only("'one'$'\\n''two'\n");
|
||||
.stdout_only("one?two\n");
|
||||
// TODO: TTY-expected output, find a way to check this as well
|
||||
// .stdout_only("'one'$'\\n''two'\n");
|
||||
|
||||
for (arg, correct) in [
|
||||
("--quoting-style=literal", "one?two"),
|
||||
|
@ -2565,7 +2568,9 @@ fn test_ls_quoting_style() {
|
|||
.ucmd()
|
||||
.arg("one two")
|
||||
.succeeds()
|
||||
.stdout_only("'one two'\n");
|
||||
.stdout_only("one two\n");
|
||||
// TODO: TTY-expected output
|
||||
// .stdout_only("'one two'\n");
|
||||
|
||||
for (arg, correct) in [
|
||||
("--quoting-style=literal", "one two"),
|
||||
|
@ -2628,7 +2633,9 @@ fn test_ls_quoting_and_color() {
|
|||
.arg("--color")
|
||||
.arg("one two")
|
||||
.succeeds()
|
||||
.stdout_only("'one two'\n");
|
||||
.stdout_only("one two\n");
|
||||
// TODO: TTY-expected output
|
||||
// .stdout_only("'one two'\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -3160,11 +3167,8 @@ fn test_ls_path() {
|
|||
.stdout_is(expected_stdout);
|
||||
|
||||
let abs_path = format!("{}/{}", at.as_string(), path);
|
||||
let expected_stdout = if cfg!(windows) {
|
||||
format!("\'{abs_path}\'\n")
|
||||
} else {
|
||||
format!("{abs_path}\n")
|
||||
};
|
||||
let expected_stdout = format!("{abs_path}\n");
|
||||
|
||||
scene.ucmd().arg(&abs_path).run().stdout_is(expected_stdout);
|
||||
|
||||
let expected_stdout = format!("{path}\n{file1}\n");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue