Permalink
Browse files

"32 to hex" should trigger the base plugin too

  • Loading branch information...
1 parent 62dc7d1 commit 055c7459e0790af490f86f45a002df07a395354c @moritz moritz committed Apr 16, 2012
Showing with 2 additions and 1 deletion.
  1. +1 −1 lib/DDG/Goodie/Base.pm
  2. +1 −0 t/Base.t
View
@@ -17,7 +17,7 @@ my %base_map = (
);
handle query_clean => sub {
- return unless /^([0-9]+)\s*(?:(?:in|as)\s+)?(hex|hexadecimal|octal|oct|binary|base\s*([0-9]+))$/;
+ return unless /^([0-9]+)\s*(?:(?:in|as|to)\s+)?(hex|hexadecimal|octal|oct|binary|base\s*([0-9]+))$/;
my $number = $1;
my $base = $3 // $base_map{$2};
return if $base < 2 || $base > 36;
View
@@ -16,6 +16,7 @@ ddg_goodie_test(
'255 in base 16' => test_zci('255 in base 16 is FF'),
'42 in binary' => test_zci('42 in base 2 is 101010'),
'42 in base 2' => test_zci('42 in base 2 is 101010'),
+ '42 to hex', => test_zci('42 in base 16 is 2A'),
);
done_testing;

0 comments on commit 055c745

Please sign in to comment.