Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Make "DuckDuckGo" in "DuckDuckGo or something" query case insensitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
GlitchMr committed Jul 6, 2012
1 parent 23ab98b commit 60a51e5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/DDG/Goodie/ABC.pm
Expand Up @@ -25,7 +25,7 @@ handle query_parts => sub {
return if scalar(@choices) <= 1;
my $choice = int(rand(@choices));

if (my @duck = grep { $_ eq 'duckduckgo' || $_ eq 'duck' || $_ eq 'ddg' } @choices) {
if (my @duck = grep { / \A (?: duck (?: duckgo )? | ddg ) \z /ix } @choices) {
return $duck[0]." (not random)", answer_type => 'egg';
}

Expand Down
1 change: 1 addition & 0 deletions t/ABC.t
Expand Up @@ -15,6 +15,7 @@ ddg_goodie_test(
'yes or no' => test_zci(qr/(yes|no) \(random\)/),
"this or that or none" => test_zci(qr/(this|that|none) \(random\)/),
"duckduckgo or google or bing or something" => test_zci("duckduckgo (not random)", answer_type => 'egg'),
"DuckDuckGo OR Google OR Bing or SOMETHING" => test_zci("DuckDuckGo (not random)", answer_type => 'egg'),
);

done_testing;
Expand Down

0 comments on commit 60a51e5

Please sign in to comment.