Add test template and non-matchers
Add functions that will be used to generate tests as well as some queries that should not match.
This commit is contained in:
parent
88f7d7b2a1
commit
f75bc864a4
35
t/GibberishGenerator.t
Normal file
35
t/GibberishGenerator.t
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user