diff options
author | Sylvestre Ledru <sylvestre@debian.org> | 2024-07-03 08:09:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-03 08:09:55 +0200 |
commit | af8e820b5e335a0c464579a8dd35b7dfade6ec87 (patch) | |
tree | 778a1d667dd9c912228d1710597887b566e885ac | |
parent | 1a1490ea599a743e3d182389177a6b4de13a8d91 (diff) | |
parent | 0c67aa8e0323aad848086914be0733966e16ef82 (diff) |
Merge pull request #6527 from Its-Just-Nans/add-ls-test
ls: add test
-rw-r--r-- | src/uu/ls/src/ls.rs | 3 | ||||
-rw-r--r-- | tests/by-util/test_ls.rs | 29 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index df055d099..b4244d12b 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -3369,7 +3369,6 @@ fn display_inode(metadata: &Metadata) -> String { // This returns the SELinux security context as UTF8 `String`. // In the long term this should be changed to `OsStr`, see discussions at #2621/#2656 -#[allow(unused_variables)] fn get_security_context(config: &Config, p_buf: &Path, must_dereference: bool) -> String { let substitute_string = "?".to_string(); // 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) - show!(LsError::IOErrorContext(err, p_buf.to_path_buf(), false)); return substitute_string; } - Ok(md) => (), + Ok(_md) => (), } } if config.selinux_supported { diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 4c326c9bc..d9ccf7915 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -2993,6 +2993,35 @@ fn test_ls_align_unquoted() { } #[test] +fn test_ls_align_unquoted_multiline() { + let scene = TestScenario::new(util_name!()); + let at = &scene.fixtures; + + at.touch("one"); + at.touch("two"); + at.touch("three_long"); + at.touch("four_long"); + at.touch("five"); + at.touch("s ix"); + at.touch("s even"); + at.touch("eight_long_long"); + at.touch("nine"); + at.touch("ten"); + + // In TTY + #[cfg(unix)] + scene + .ucmd() + .arg("--color") + .terminal_simulation(true) + .succeeds() + .stdout_only(concat!( + " eight_long_long four_long one 's ix' three_long\r\n", + " five nine 's even' ten two\r\n" + )); +} + +#[test] fn test_ls_ignore_hide() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; |