mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
ls colors: create a stylemanager to carry the previous style to know if we need to reset or not
This commit is contained in:
parent
b676216f9b
commit
268b180416
2 changed files with 91 additions and 17 deletions
|
@ -3903,3 +3903,23 @@ fn test_ls_hyperlink() {
|
|||
.succeeds()
|
||||
.stdout_is(format!("{file}\n"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_ls_color_do_not_reset() {
|
||||
let scene: TestScenario = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.mkdir("example");
|
||||
at.mkdir("example/a");
|
||||
at.mkdir("example/b");
|
||||
|
||||
let result = scene
|
||||
.ucmd()
|
||||
.arg("--color=always")
|
||||
.arg("example/")
|
||||
.succeeds();
|
||||
// the second color code should not have a reset
|
||||
assert_eq!(
|
||||
result.stdout_str().escape_default().to_string(),
|
||||
"\\u{1b}[0m\\u{1b}[01;34ma\\u{1b}[0m\\n\\u{1b}[01;34mb\\u{1b}[0m\\n"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue