From 801c3d561c4893de90f8d0097bb2c6ed34099e58 Mon Sep 17 00:00:00 2001 From: gdrooid Date: Fri, 4 Jul 2014 23:05:13 +0200 Subject: [PATCH] MD5: Add tests and fix previous commit. --- lib/DDG/Goodie/MD5.pm | 2 +- t/MD5.t | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/DDG/Goodie/MD5.pm b/lib/DDG/Goodie/MD5.pm index 194b37190..700170f9f 100644 --- a/lib/DDG/Goodie/MD5.pm +++ b/lib/DDG/Goodie/MD5.pm @@ -31,7 +31,7 @@ sub html_output { } handle remainder => sub { - s/of "?([^"]*)"?/$1/; + s/^of "?([^"]*)"?$/$1/; if (/^\s*(.*)\s*$/) { # Exit unless a string is found return unless $1; diff --git a/t/MD5.t b/t/MD5.t index 27c135c3e..1bfadb57a 100644 --- a/t/MD5.t +++ b/t/MD5.t @@ -15,6 +15,8 @@ ddg_goodie_test( 'md5 digest this!' => test_zci('3838c8fb10a114e6d21203359ef147ad', html=>qr/.*/), 'duckduckgo md5' => test_zci('96898bb8544fa56b03c08cdc09886c6c', html=>qr/.*/), 'md5sum the sum of a string' => test_zci('a704c8833f9850cd342ead27207ca1a1', html=>qr/.*/), + 'md5 of password' => test_zci('5f4dcc3b5aa765d61d8327deb882cf99', html=>qr/.*/), + 'md5sum of "this"' => test_zci('9e925e9341b490bfd3b4c4ca3b0c1ef2', html=>qr/.*/), ); done_testing;