+
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions src/find/matchers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ fn build_matcher_tree(
invert_next_matcher = !invert_next_matcher;
None
}
"-a" => {
"-and" | "-a" => {
if !are_more_expressions(args, i) {
return Err(From::from(format!(
"expected an expression after {}",
Expand Down Expand Up @@ -674,17 +674,19 @@ mod tests {

#[test]
fn build_top_level_matcher_dash_a_works() {
let abbbc = get_dir_entry_for("./test_data/simple", "abbbc");
let mut config = Config::default();
let deps = FakeDependencies::new();
for arg in &["-a", "-and"] {
let abbbc = get_dir_entry_for("./test_data/simple", "abbbc");
let mut config = Config::default();
let deps = FakeDependencies::new();

// build a matcher using an explicit -a argument
let matcher = build_top_level_matcher(&["-true", "-a", "-true"], &mut config).unwrap();
assert!(matcher.matches(&abbbc, &mut deps.new_matcher_io()));
assert_eq!(
deps.get_output_as_string(),
fix_up_slashes("./test_data/simple/abbbc\n")
);
// build a matcher using an explicit -a argument
let matcher = build_top_level_matcher(&["-true", arg, "-true"], &mut config).unwrap();
assert!(matcher.matches(&abbbc, &mut deps.new_matcher_io()));
assert_eq!(
deps.get_output_as_string(),
fix_up_slashes("./test_data/simple/abbbc\n")
);
}
}

#[test]
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载