mirror of
https://github.com/bootandy/dust.git
synced 2026-06-08 11:29:05 +03:00
Fix issues from running on root directory
clean up: 80338f4
Fixes -d flag to work again. Add test to stop regression
This commit is contained in:
+12
-14
@@ -45,13 +45,7 @@ fn main_output(short_paths: bool) -> String {
|
||||
{}
|
||||
{}",
|
||||
format_string("src/test_dir", true, short_paths, " 4.0K", "─┬"),
|
||||
format_string(
|
||||
"src/test_dir/many",
|
||||
true,
|
||||
short_paths,
|
||||
" 4.0K",
|
||||
" └─┬",
|
||||
),
|
||||
format_string("src/test_dir/many", true, short_paths, " 4.0K", " └─┬",),
|
||||
format_string(
|
||||
"src/test_dir/many/hello_file",
|
||||
true,
|
||||
@@ -77,13 +71,7 @@ fn main_output(short_paths: bool) -> String {
|
||||
{}
|
||||
{}",
|
||||
format_string("src/test_dir", true, short_paths, " 12K", "─┬"),
|
||||
format_string(
|
||||
"src/test_dir/many",
|
||||
true,
|
||||
short_paths,
|
||||
" 8.0K",
|
||||
" └─┬",
|
||||
),
|
||||
format_string("src/test_dir/many", true, short_paths, " 8.0K", " └─┬",),
|
||||
format_string(
|
||||
"src/test_dir/many/hello_file",
|
||||
true,
|
||||
@@ -121,6 +109,16 @@ pub fn test_apparent_size() {
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
pub fn test_d_flag_works() {
|
||||
// We should see the top level directory but not the sub dirs / files:
|
||||
assert_cli::Assert::main_binary()
|
||||
.with_args(&["-d", "1", "-s", "src/test_dir"])
|
||||
.stdout()
|
||||
.doesnt_contain("hello_file")
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn build_temp_file(dir: &TempDir) -> (PathBuf) {
|
||||
let file_path = dir.path().join("notes.txt");
|
||||
let mut file = File::create(&file_path).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user