From 147c0b6962f1a3464e2386f2dea1a875e54cdb03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dorian=20P=C3=A9ron?= Date: Tue, 14 May 2024 00:47:27 +0200 Subject: [PATCH] tests(ls): Test space alignment when quoting is involved on grid output --- tests/by-util/test_ls.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index b0dfb63ba..596f1954d 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2950,6 +2950,41 @@ fn test_ls_quoting_and_color() { .stdout_only("'one two'\r\n"); } +#[test] +fn test_ls_align_unquoted() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("elf two"); + at.touch("foobar"); + at.touch("CAPS"); + at.touch("'quoted'"); + + // In TTY + scene + .ucmd() + .arg("--color") + .terminal_simulation(true) + .succeeds() + .stdout_only("\"'quoted'\" CAPS 'elf two' foobar\r\n"); + // ^ ^ ^ + // space no-space space + + // The same should happen with format columns/across + // and shell quoting style, except for the `\r` at the end. + for format in &["--format=column", "--format=across"] { + scene + .ucmd() + .arg("--color") + .arg(format) + .arg("--quoting-style=shell") + .succeeds() + .stdout_only("\"'quoted'\" CAPS 'elf two' foobar\n"); + // ^ ^ ^ + // space no-space space + } +} + #[test] fn test_ls_ignore_hide() { let scene = TestScenario::new(util_name!());