This repository has been archived by the owner on Oct 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2405 from swapagarwal/beam-me-up-scotty
New Star Trek Code Phrase
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |