2014-01-31 16:26:50 -08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
use Test::More;
|
2016-05-16 06:07:57 -07:00
|
|
|
use Test::Deep;
|
2014-01-31 16:26:50 -08:00
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
2014-09-27 06:42:57 -07:00
|
|
|
zci answer_type => 'xkcd_sandwich';
|
|
|
|
zci is_cached => 1;
|
2014-01-31 16:26:50 -08:00
|
|
|
|
2016-05-16 13:40:48 -07:00
|
|
|
my $yes = 'Okay.';
|
|
|
|
my $no = 'What? Make it yourself.';
|
|
|
|
|
|
|
|
sub build_test
|
|
|
|
{
|
|
|
|
my ($text, $input) = @_;
|
|
|
|
return test_zci($text, structured_answer => {
|
|
|
|
data => {
|
2016-05-24 09:50:14 -07:00
|
|
|
title => $text,
|
|
|
|
subtitle => [
|
2016-05-24 12:22:03 -07:00
|
|
|
$input,
|
2016-05-24 09:50:14 -07:00
|
|
|
{ text => "XKCD 149", href => "https://duckduckgo.com/?q=xkcd%20149"}
|
|
|
|
]
|
2016-05-16 13:40:48 -07:00
|
|
|
},
|
|
|
|
templates => {
|
|
|
|
group => 'text'
|
|
|
|
}
|
2014-10-09 01:44:11 -07:00
|
|
|
});
|
2016-05-16 13:40:48 -07:00
|
|
|
}
|
2014-10-09 01:44:11 -07:00
|
|
|
|
2014-01-31 16:26:50 -08:00
|
|
|
ddg_goodie_test(
|
2014-10-09 01:44:11 -07:00
|
|
|
['DDG::Goodie::MakeMeASandwich'],
|
2016-05-16 13:40:48 -07:00
|
|
|
'make me a sandwich' => build_test($no, "make me a sandwich"),
|
|
|
|
'MAKE ME A SANDWICH' => build_test($no, "make me a sandwich"),
|
|
|
|
'sudo make me a sandwich' => build_test($yes, "sudo make me a sandwich"),
|
|
|
|
'SUDO MAKE ME A SANDWICH' => build_test($yes, 'sudo make me a sandwich'),
|
2014-02-02 08:52:42 -08:00
|
|
|
'blahblah make me a sandwich' => undef,
|
2014-10-09 01:44:11 -07:00
|
|
|
'0 make me a sandwich' => undef,
|
2014-01-31 16:26:50 -08:00
|
|
|
);
|
|
|
|
|
2016-05-16 06:18:04 -07:00
|
|
|
done_testing;
|