From 986ce7cf00534b9281cc22999025a714c8fdeea9 Mon Sep 17 00:00:00 2001 From: Sigurd Holsen Date: Thu, 29 Aug 2024 17:32:09 +0200 Subject: [PATCH] Add test for listing only directories (#23) --- src/tests/test_simple.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/test_simple.rs b/src/tests/test_simple.rs index a59db75..085c14b 100644 --- a/src/tests/test_simple.rs +++ b/src/tests/test_simple.rs @@ -79,3 +79,26 @@ fn test_filter_txt_files() { assert_eq!(expected, output); } + +#[test] +fn test_only_directories() { + let expected = r#"simple +└── yyy + ├── k + ├── s + └── zz + └── a + └── b +"#; + let (output, summary) = run_cmd( + Path::new("tests/simple"), + Config { + show_only_dirs: true, + ..Default::default() + }, + ); + + assert_eq!(expected, output); + assert_eq!(6, summary.num_folders); + assert_eq!(0, summary.num_files); +}