Merge branch 'main' into stat

This commit is contained in:
Sylvestre Ledru
2022-06-01 08:42:44 +01:00
committed by GitHub
3 changed files with 54 additions and 1 deletions
+1 -1
View File
@@ -481,7 +481,7 @@ fn build_matcher_tree(
config.depth_first = true;
None
}
"-xdev" => {
"-mount" | "-xdev" => {
// TODO add warning if it appears after actual testing criterion
config.same_file_system = true;
None
+2
View File
@@ -67,6 +67,8 @@ impl FromStr for RegexType {
"grep" => Ok(Self::Grep),
"posix-basic" => Ok(Self::PosixBasic),
"posix-extended" => Ok(Self::PosixExtended),
// ed and sed are the same as posix-basic
"ed" | "sed" => Ok(Self::PosixBasic),
_ => Err(ParseRegexTypeError(s.to_owned())),
}
}
+51
View File
@@ -190,6 +190,34 @@ fn regex_types() {
.success()
.stderr(predicate::str::is_empty())
.stdout(predicate::str::contains("teeest"));
Command::cargo_bin("find")
.expect("found binary")
.args(&[
&temp_dir_path,
"-regextype",
"ed",
"-regex",
&fix_up_regex_slashes(r".*/te\{1,3\}st"),
])
.assert()
.success()
.stderr(predicate::str::is_empty())
.stdout(predicate::str::contains("teeest"));
Command::cargo_bin("find")
.expect("found binary")
.args(&[
&temp_dir_path,
"-regextype",
"sed",
"-regex",
&fix_up_regex_slashes(r".*/te\{1,3\}st"),
])
.assert()
.success()
.stderr(predicate::str::is_empty())
.stdout(predicate::str::contains("teeest"));
}
#[test]
@@ -412,3 +440,26 @@ fn find_links() {
.stderr(predicate::str::is_empty())
.stdout(predicate::str::contains("abbbc"));
}
#[serial(working_dir)]
#[test]
fn find_mount_xdev() {
// Make sure that -mount/-xdev doesn't prune unexpectedly.
// TODO: Test with a mount point in the search.
Command::cargo_bin("find")
.expect("found binary")
.args(&["test_data", "-mount"])
.assert()
.success()
.stderr(predicate::str::is_empty())
.stdout(predicate::str::contains("abbbc"));
Command::cargo_bin("find")
.expect("found binary")
.args(&["test_data", "-xdev"])
.assert()
.success()
.stderr(predicate::str::is_empty())
.stdout(predicate::str::contains("abbbc"));
}