Added tests for the Regexp plugin.

master
Jag Talon 2013-03-11 16:27:50 -04:00
parent fe63c0ca8b
commit 77d3bfb315
2 changed files with 22 additions and 1 deletions

View File

@ -16,7 +16,7 @@ attribution web => [ 'https://www.duckduckgo.com', 'DuckDuckGo' ],
github => [ 'https://github.com/duckduckgo', 'duckduckgo'],
twitter => ['http://twitter.com/duckduckgo', 'duckduckgo'];
triggers query_lc => qr/^regexp [\/\\](.*?)[\/\\] (.*)$/i;
triggers query_lc => qr/^regexp [\/\\](.+?)[\/\\] (.+)$/i;
handle query => sub {
my $regexp = $1;

21
t/Regexp.t Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => 'regexp';
zci is_cached => 1;
ddg_goodie_test(
[qw( DDG::Goodie::Regexp )],
'regexp /(hello)/ hello probably' => test_zci(
"hello",
),
'regexp /(dd)/ ddg' => test_zci(
"dd",
),
);
done_testing;