mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
ls: Add missing quote with --quoting-style=shell-escape
Should fix GNU: tests/ls/symlink-quote.sh
This commit is contained in:
parent
98376d8fd5
commit
bbee22bb1c
2 changed files with 42 additions and 1 deletions
|
@ -2568,7 +2568,8 @@ fn display_file_name(
|
|||
}
|
||||
} else {
|
||||
// If no coloring is required, we just use target as is.
|
||||
name.push_str(&target.to_string_lossy());
|
||||
// Apply the right quoting
|
||||
name.push_str(&escape_name(&target.as_os_str(), &config.quoting_style));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2913,3 +2913,43 @@ fn test_ls_multiple_a_A() {
|
|||
.stdout_does_not_contain(".")
|
||||
.stdout_does_not_contain("..");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ls_quoting() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
||||
scene
|
||||
.ccmd("ln")
|
||||
.arg("-s")
|
||||
.arg("'need quoting'")
|
||||
.arg("symlink")
|
||||
.succeeds();
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-l")
|
||||
.arg("--quoting-style=shell-escape")
|
||||
.arg("symlink")
|
||||
.succeeds()
|
||||
.stdout_contains("\'need quoting\'");
|
||||
}
|
||||
|
||||
//#[test]
|
||||
// Enable when support with color is added
|
||||
fn test_ls_quoting_auto() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
|
||||
scene
|
||||
.ccmd("ln")
|
||||
.arg("-s")
|
||||
.arg("'need quoting'")
|
||||
.arg("symlink")
|
||||
.succeeds();
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-l")
|
||||
.arg("--quoting-style=shell-escape")
|
||||
.arg("--color=auto")
|
||||
.arg("symlink")
|
||||
.succeeds()
|
||||
.stdout_contains("\'need quoting\'");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue