diff --git a/src/display.rs b/src/display.rs index a923d1aad..e4e42d9c3 100644 --- a/src/display.rs +++ b/src/display.rs @@ -115,8 +115,7 @@ fn inner_display_grid( // Maybe skip showing the directory meta now; show its contents later. if skip_dirs && (matches!(meta.file_type, FileType::Directory { .. }) - || (matches!(meta.file_type, FileType::SymLink { is_dir: true }) - && flags.layout != Layout::OneLine)) + || (matches!(meta.file_type, FileType::SymLink { is_dir: true }))) { continue; } diff --git a/tests/integration.rs b/tests/integration.rs index 11ef41f0b..5c2380b5b 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -322,22 +322,6 @@ fn test_dereference_link_broken_link_output() { .stdout(predicate::str::starts_with("l????????? ? ? ? ?")); } -#[cfg(unix)] -#[test] -fn test_show_folder_content_of_symlink() { - let dir = tempdir(); - dir.child("target").child("inside").touch().unwrap(); - let link = dir.path().join("link"); - fs::symlink("target", &link).unwrap(); - - cmd() - .arg("--ignore-config") - .arg(link) - .assert() - .stdout(predicate::str::starts_with("link").not()) - .stdout(predicate::str::starts_with("inside")); -} - #[cfg(unix)] #[test] fn test_no_show_folder_content_of_symlink_for_long() { diff --git a/tests/lscompatible.rs b/tests/lscompatible.rs index f5c74db42..91a29b4aa 100644 --- a/tests/lscompatible.rs +++ b/tests/lscompatible.rs @@ -1,8 +1,13 @@ +/// This is tests make sure lsd is compatible with the GNU ls +/// The tests here MUST all pass in every changes extern crate assert_cmd; extern crate predicates; use assert_cmd::prelude::*; use assert_fs::prelude::*; +use predicates::prelude::*; +#[cfg(unix)] +use std::os::unix::fs; use std::process::{Command, Stdio}; fn cmd() -> Command { @@ -52,3 +57,36 @@ fn test_pipe_should_use_line() { assert_eq!(output_ls.stdout, output_lsd.stdout); } + +#[cfg(unix)] +#[test] +fn test_show_folder_content_of_symlink_oneline() { + let dir = tempdir(); + dir.child("target").child("inside").touch().unwrap(); + let link = dir.path().join("link"); + fs::symlink("target", &link).unwrap(); + + cmd() + .arg("--ignore-config") + .arg("--oneline") + .arg(link) + .assert() + .stdout(predicate::str::starts_with("link").not()) + .stdout(predicate::str::starts_with("inside")); +} + +#[cfg(unix)] +#[test] +fn test_show_folder_content_of_symlink() { + let dir = tempdir(); + dir.child("target").child("inside").touch().unwrap(); + let link = dir.path().join("link"); + fs::symlink("target", &link).unwrap(); + + cmd() + .arg("--ignore-config") + .arg(link) + .assert() + .stdout(predicate::str::starts_with("link").not()) + .stdout(predicate::str::starts_with("inside")); +}