add a max-depth option for directory traversal

CR and add integration test
This commit is contained in:
Garrett Squire
2016-09-26 20:56:15 -07:00
parent 3e892a7a80
commit babe80d498
3 changed files with 30 additions and 1 deletions

View File

@@ -831,6 +831,21 @@ sherlock\x00can extract a clew from a wisp of straw or a flake of cigar ash;
assert_eq!(lines, expected);
});
// See: https://github.com/BurntSushi/ripgrep/issues/109
clean!(max_depth, "far", ".", |wd: WorkDir, mut cmd: Command| {
wd.create_dir("one");
wd.create("one/pass", "far");
wd.create_dir("one/too");
wd.create("one/too/many", "far");
cmd.arg("--maxdepth").arg("2");
let lines: String = wd.stdout(&mut cmd);
let expected = path("one/pass:far\n");
assert_eq!(lines, expected);
});
#[test]
fn binary_nosearch() {
let wd = WorkDir::new("binary_nosearch");