diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 8ecabf86d..b0dfb63ba 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2686,16 +2686,24 @@ fn test_ls_quoting_style() { { at.touch("one\ntwo"); at.touch("one\\two"); - // Default is literal, when stdout is not a TTY. - // Otherwise, it is shell-escape + + // Default is literal, when stdout is not a TTY... scene .ucmd() .arg("--hide-control-chars") .arg("one\ntwo") .succeeds() .stdout_only("one?two\n"); - // TODO: TTY-expected output, find a way to check this as well - // .stdout_only("'one'$'\\n''two'\n"); + + // ... Otherwise, it is shell-escape + #[cfg(unix)] + scene + .ucmd() + .arg("--hide-control-chars") + .arg("one\ntwo") + .terminal_simulation(true) + .succeeds() + .stdout_only("'one'$'\\n''two'\r\n"); for (arg, correct) in [ ("--quoting-style=literal", "one?two"), @@ -2786,13 +2794,21 @@ fn test_ls_quoting_style() { } } + // No-TTY scene .ucmd() .arg("one two") .succeeds() .stdout_only("one two\n"); - // TODO: TTY-expected output - // .stdout_only("'one two'\n"); + + // TTY + #[cfg(unix)] + scene + .ucmd() + .arg("one two") + .terminal_simulation(true) + .succeeds() + .stdout_only("'one two'\r\n"); for (arg, correct) in [ ("--quoting-style=literal", "one two"), @@ -2914,14 +2930,24 @@ fn test_ls_quoting_and_color() { let at = &scene.fixtures; at.touch("one two"); + + // No-TTY scene .ucmd() .arg("--color") .arg("one two") .succeeds() .stdout_only("one two\n"); - // TODO: TTY-expected output - // .stdout_only("'one two'\n"); + + // TTY + #[cfg(unix)] + scene + .ucmd() + .arg("--color") + .arg("one two") + .terminal_simulation(true) + .succeeds() + .stdout_only("'one two'\r\n"); } #[test]