diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 0cb6d8a81..82c5a4318 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -56,8 +56,8 @@ fn test_ls_ordering() { .stdout_matches(&Regex::new("some-dir1:\\ntotal 0").unwrap()); } -#[cfg(all(feature = "chmod"))] #[test] +#[cfg(feature = "chmod")] fn test_ls_io_errors() { let scene = TestScenario::new(util_name!()); let at = &scene.fixtures; @@ -105,6 +105,16 @@ fn test_ls_io_errors() { .stderr_contains("cannot open directory") .stderr_contains("Permission denied") .stdout_contains("some-dir4"); + + // test we don't double print on dangling link metadata errors + scene + .ucmd() + .arg("-iRL") + .arg("some-dir2") + .fails() + .stderr_does_not_contain( + "ls: cannot access 'some-dir2/dangle': No such file or directory\nls: cannot access 'some-dir2/dangle': No such file or directory" + ); } #[test]