New LHC Apocalypse Checker Instant Answer (#3597)
* Completed perl file, delivering simple response * The start of a test file * finish test file, add plain text result.master
parent
14526e606f
commit
242793b659
|
@ -0,0 +1,38 @@
|
|||
package DDG::Goodie::HasLHCDestroyedWorld;
|
||||
|
||||
# ABSTRACT: Has the Large Hadron Collider destroyed the world yet? Nope.
|
||||
|
||||
use DDG::Goodie;
|
||||
use strict;
|
||||
|
||||
zci answer_type => 'has_lhcdestroyed_world';
|
||||
zci is_cached => 1;
|
||||
|
||||
triggers any => 'has the large hadron collider destroyed the world',
|
||||
'has the lhc destroyed the world',
|
||||
'has the large hadron collider destroyed the earth',
|
||||
'has the lhc destroyed the earth';
|
||||
|
||||
# Handle statement
|
||||
handle remainder => sub {
|
||||
|
||||
return "Nope.",
|
||||
structured_answer => {
|
||||
id => 'has_lhcdestroyed_world',
|
||||
name => 'Answer',
|
||||
data => {
|
||||
title => "Has it?",
|
||||
subtitle => "Nope."
|
||||
},
|
||||
meta => {
|
||||
sourceName => "Has the Large Hadron Collider destroyed the world yet?",
|
||||
sourceUrl => "http://hasthelargehadroncolliderdestroyedtheworldyet.com/"
|
||||
},
|
||||
templates => {
|
||||
group => "text",
|
||||
moreAt => 1
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
1;
|
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => "has_lhcdestroyed_world";
|
||||
zci is_cached => 1;
|
||||
|
||||
# The one structured answer containing the message, "Nope."
|
||||
my @no = (
|
||||
"Nope.",
|
||||
structured_answer => {
|
||||
id => 'has_lhcdestroyed_world',
|
||||
name => 'Answer',
|
||||
data => {
|
||||
title => "Has it?",
|
||||
subtitle => "Nope."
|
||||
},
|
||||
meta => {
|
||||
sourceName => "Has the Large Hadron Collider destroyed the world yet?",
|
||||
sourceUrl => "http://hasthelargehadroncolliderdestroyedtheworldyet.com/"
|
||||
},
|
||||
templates => {
|
||||
group => "text",
|
||||
moreAt => 1
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw( DDG::Goodie::HasLHCDestroyedWorld )],
|
||||
'has the large hadron collider destroyed the world yet' => test_zci(@no),
|
||||
'has the large hadron collider destroyed the world' => test_zci(@no),
|
||||
'has the lhc destroyed the world yet' => test_zci(@no),
|
||||
'has the lhc destroyed the world' => test_zci(@no),
|
||||
'has the large hadron collider destroyed the earth yet' => test_zci(@no),
|
||||
'has the large hadron collider destroyed the earth' => test_zci(@no),
|
||||
'has the lhc destroyed the earth yet' => test_zci(@no),
|
||||
'has the lhc destroyed the earth' => test_zci(@no),
|
||||
|
||||
|
||||
'large hadron collider' => undef,
|
||||
'could the large hadron collider destroyed the world' => undef,
|
||||
'will the large hadron collider destroy the earth' => undef
|
||||
);
|
||||
|
||||
done_testing;
|
Loading…
Reference in New Issue