Skip to content

Commit af8e820

Browse files
authored
Merge pull request #6527 from Its-Just-Nans/add-ls-test
ls: add test
2 parents 1a1490e + 0c67aa8 commit af8e820

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/uu/ls/src/ls.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3369,7 +3369,6 @@ fn display_inode(metadata: &Metadata) -> String {
33693369

33703370
// This returns the SELinux security context as UTF8 `String`.
33713371
// In the long term this should be changed to `OsStr`, see discussions at #2621/#2656
3372-
#[allow(unused_variables)]
33733372
fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -> String {
33743373
let substitute_string = "?".to_string();
33753374
// If we must dereference, ensure that the symlink is actually valid even if the system
@@ -3383,7 +3382,7 @@ fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -
33833382
show!(LsError::IOErrorContext(err, p_buf.to_path_buf(), false));
33843383
return substitute_string;
33853384
}
3386-
Ok(md) => (),
3385+
Ok(_md) => (),
33873386
}
33883387
}
33893388
if config.selinux_supported {

tests/by-util/test_ls.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2992,6 +2992,35 @@ fn test_ls_align_unquoted() {
29922992
}
29932993
}
29942994

2995+
#[test]
2996+
fn test_ls_align_unquoted_multiline() {
2997+
let scene = TestScenario::new(util_name!());
2998+
let at = &scene.fixtures;
2999+
3000+
at.touch("one");
3001+
at.touch("two");
3002+
at.touch("three_long");
3003+
at.touch("four_long");
3004+
at.touch("five");
3005+
at.touch("s ix");
3006+
at.touch("s even");
3007+
at.touch("eight_long_long");
3008+
at.touch("nine");
3009+
at.touch("ten");
3010+
3011+
// In TTY
3012+
#[cfg(unix)]
3013+
scene
3014+
.ucmd()
3015+
.arg("--color")
3016+
.terminal_simulation(true)
3017+
.succeeds()
3018+
.stdout_only(concat!(
3019+
" eight_long_long four_long one 's ix' three_long\r\n",
3020+
" five nine 's even' ten two\r\n"
3021+
));
3022+
}
3023+
29953024
#[test]
29963025
fn test_ls_ignore_hide() {
29973026
let scene = TestScenario::new(util_name!());

0 commit comments

Comments
 (0)