Add test template and non-matchers

Add functions that will be used to generate tests as well as some
queries that should not match.
master
Ben Moon 2015-12-27 13:52:31 +00:00
parent 88f7d7b2a1
commit f75bc864a4
1 changed files with 35 additions and 0 deletions

35
t/GibberishGenerator.t Normal file
View File

@ -0,0 +1,35 @@
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
use utf8;
zci answer_type => 'gibberish_generator';
zci is_cached => 0;
sub build_result {
my $result = shift;
return $result, structured_answer => {
id => 'gibberishgenerator',
name => 'Answer',
data => '-ANY-',
templates => {
group => 'text',
moreAt => 0,
},
};
}
sub build_test { test_zci(build_result(qr/^$_[0]$/)) }
ddg_goodie_test(
[qw( DDG::Goodie::GibberishGenerator )],
# Non-matchers
'utter nonsense' => undef,
'nonsense word' => undef,
'what is a word of nonsense' => undef,
'three french hens and a nonsense word' => undef,
);
done_testing;