zeroclickinfo-goodies/t/Stardate.t

34 lines
689 B
Perl
Raw Normal View History

2016-03-06 21:01:22 -08:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use Test::Deep;
2016-03-06 21:01:22 -08:00
use DDG::Test::Goodie;
zci answer_type => "stardate";
zci is_cached => 0;
sub build_structured_answer {
return re(qr/[0-9]{8}\.[0-9]{1,5}/),
2016-03-06 21:01:22 -08:00
structured_answer => {
data => ignore(),
2016-03-06 21:01:22 -08:00
templates => {
group => 'text',
},
};
}
sub build_test { test_zci(build_structured_answer(@_)) }
ddg_goodie_test(
[qw( DDG::Goodie::Stardate )],
'stardate' => build_test(),
'stardate 2 months ago' => build_test(),
'stardate in 2 years' => build_test(),
2016-03-06 21:01:22 -08:00
'star date' => undef,
2016-04-17 13:11:37 -07:00
'stardate 29 feb 2015' => undef,
2016-03-06 21:01:22 -08:00
);
2016-05-16 06:18:04 -07:00
done_testing;