summaryrefslogtreecommitdiffstats
path: root/tests/by-util
diff options
context:
space:
mode:
authorsreehari prasad <52113972+matrixhead@users.noreply.github.com>2024-06-29 13:36:00 +0530
committerGitHub <noreply@github.com>2024-06-29 10:06:00 +0200
commitdbeae9f4442744b848c1e3fbe31db1bdbede7328 (patch)
tree8708dede3d877bfaf6c79f64fe3dd1aa05632914 /tests/by-util
parentf451714d26b6a58eab7f40ad3ea5b5171df29c45 (diff)
ls: gnu `color-clear-to-eol` fix (#6507)
--------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
Diffstat (limited to 'tests/by-util')
-rw-r--r--tests/by-util/test_ls.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs
index cf73ba5d6..bf4382e8e 100644
--- a/tests/by-util/test_ls.rs
+++ b/tests/by-util/test_ls.rs
@@ -4803,3 +4803,26 @@ fn test_ls_color_norm() {
.succeeds()
.stdout_contains(expected);
}
+
+#[test]
+fn test_ls_color_clear_to_eol() {
+ let scene = TestScenario::new(util_name!());
+ let at = &scene.fixtures;
+ // we create file with a long name
+ at.touch("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo");
+ let result = scene
+ .ucmd()
+ .env("TERM", "xterm")
+ // set the columns to something small so that the text would wrap around
+ .env("COLUMNS", "80")
+ // set the background to green and text to red
+ .env("LS_COLORS", "*.foo=0;31;42")
+ .env("TIME_STYLE", "+T")
+ .arg("-og")
+ .arg("--color")
+ .arg("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo")
+ .succeeds();
+ // check that the wrapped name contains clear to end of line code
+ // cspell:disable-next-line
+ result.stdout_contains("\x1b[0m\x1b[31;42mzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz.foo\x1b[0m\x1b[K");
+}