Beam me up, Scotty!

master
sagarwal 2016-02-21 02:32:40 +00:00
parent ea1f924c0f
commit f5f9c0f15f
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package DDG::Goodie::BeamMeUpScotty;
# ABSTRACT: A Star Trek catchphrase
use DDG::Goodie;
use strict;
zci answer_type => 'beam_me_up_scotty';
zci is_cached => 1;
triggers start => 'beam me up scotty', 'beam us up scotty';
handle remainder => sub {
return unless ($_ eq '');
my $answer = 'Aye, aye, captain.';
return $answer,
structured_answer => {
input => ['Beam me up, Scotty'],
operation => 'Code phrase',
result => $answer
};
};
1;

33
t/BeamMeUpScotty.t Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => "beam_me_up_scotty";
zci is_cached => 1;
ddg_goodie_test(
[qw( DDG::Goodie::BeamMeUpScotty )],
'beam me up scotty' => test_zci(
'Aye, aye, captain.',
structured_answer => {
input => ['Beam me up, Scotty'],
operation => 'Code phrase',
result => 'Aye, aye, captain.'
}
),
'beam us up scotty' => test_zci(
'Aye, aye, captain.',
structured_answer => {
input => ['Beam me up, Scotty'],
operation => 'Code phrase',
result => 'Aye, aye, captain.'
}
),
'beam me up' => undef,
'scotty beam us up' => undef,
);
done_testing;