Added tests for the Regexp plugin.
parent
fe63c0ca8b
commit
77d3bfb315
|
@ -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;
|
||||
|
|
|
@ -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;
|
Loading…
Reference in New Issue