From 1d018bc80bcde26a55e97257f7bf716c72aa14f6 Mon Sep 17 00:00:00 2001 From: "andy.boot" Date: Thu, 3 Sep 2020 22:08:27 +0100 Subject: [PATCH] Add test to check behaviour of -d flag Covers the case fixed by the previous commit --- tests/test_flags.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_flags.rs b/tests/test_flags.rs index 69f661b..6dbaf4a 100644 --- a/tests/test_flags.rs +++ b/tests/test_flags.rs @@ -65,6 +65,23 @@ pub fn test_d_flag_works() { assert!(!output.contains("hello_file")); } +#[test] +pub fn test_d_flag_works_and_still_recurses_down() { + // We had a bug where running with '-d 1' would stop at the first directory and the code + // would fail to recurse down + let mut cmd = Command::cargo_bin("dust").unwrap(); + let output = cmd + .arg("-d") + .arg("1") + .arg("-f") + .arg("-c") + .arg("tests/test_dir2/") + .unwrap() + .stdout; + let output = str::from_utf8(&output).unwrap(); + assert!(output.contains("7 ┌─┴ test_dir2")); +} + // Check against directories and files whos names are substrings of each other #[test] pub fn test_ignore_dir() {