1
Fork 0
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:
Sylvestre Ledru 2022-03-26 11:30:07 +01:00
parent 98376d8fd5
commit bbee22bb1c
2 changed files with 42 additions and 1 deletions

View file

@ -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));
}
}
}

View file

@ -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\'");
}