1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

ls: gnu color-clear-to-eol fix (#6507)

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
This commit is contained in:
sreehari prasad 2024-06-29 13:36:00 +05:30 committed by GitHub
parent f451714d26
commit dbeae9f444
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 103 additions and 26 deletions

View file

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