Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #107 from GlitchMr/case-insensitive-duckduckgo

Make "DuckDuckGo" in "DuckDuckGo or something" query case insensitive.
  • Loading branch information...
commit 90f161716ae994885215992c5af49c22788907e9 2 parents f425fd0 + 60a51e5
Dylan Lloyd nospampleasemam authored
Showing with 2 additions and 1 deletion.
  1. +1 −1  lib/DDG/Goodie/ABC.pm
  2. +1 −0  t/ABC.t
2  lib/DDG/Goodie/ABC.pm
View
@@ -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';
}
1  t/ABC.t
View
@@ -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;
Please sign in to comment.
Something went wrong with that request. Please try again.