mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
tests(ls): Test default quoting style on TTY output
This commit is contained in:
parent
23d5235e7c
commit
0209c90b4e
1 changed files with 34 additions and 8 deletions
|
@ -2686,16 +2686,24 @@ fn test_ls_quoting_style() {
|
||||||
{
|
{
|
||||||
at.touch("one\ntwo");
|
at.touch("one\ntwo");
|
||||||
at.touch("one\\two");
|
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
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("--hide-control-chars")
|
.arg("--hide-control-chars")
|
||||||
.arg("one\ntwo")
|
.arg("one\ntwo")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("one?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");
|
// ... 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 [
|
for (arg, correct) in [
|
||||||
("--quoting-style=literal", "one?two"),
|
("--quoting-style=literal", "one?two"),
|
||||||
|
@ -2786,13 +2794,21 @@ fn test_ls_quoting_style() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// No-TTY
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("one two")
|
.arg("one two")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("one two\n");
|
.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 [
|
for (arg, correct) in [
|
||||||
("--quoting-style=literal", "one two"),
|
("--quoting-style=literal", "one two"),
|
||||||
|
@ -2914,14 +2930,24 @@ fn test_ls_quoting_and_color() {
|
||||||
let at = &scene.fixtures;
|
let at = &scene.fixtures;
|
||||||
|
|
||||||
at.touch("one two");
|
at.touch("one two");
|
||||||
|
|
||||||
|
// No-TTY
|
||||||
scene
|
scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg("--color")
|
.arg("--color")
|
||||||
.arg("one two")
|
.arg("one two")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_only("one two\n");
|
.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]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue