Merge pull request #605 from exoWM/master

Hitchhiker's Guide Easter egg IA
master
Zaahir Moolla 2014-09-04 16:12:14 -04:00
commit ff280e81c5
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package DDG::Goodie::UltimateAnswer;
# ABSTRACT: A Hitchhiker's Guide to the Galaxy easter egg.
use DDG::Goodie;
triggers start => 'what is the ultimate answer', 'what is the ultimate answer to life the universe and everything';
primary_example_queries 'what is the ultimate answer to the life universe and everything';
name 'Ultimate Answer';
description 'Hichhiker\'s Guide to the Galaxy reference.';
category 'special';
topics 'entertainment';
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/UltimateAnswer.pm';
attribution github => ['https://github.com/exoWM/', 'exoWM'],
twitter => ['https://twitter.com/jfeeneywm', 'jfeeneywm'];
zci answer_type => 'UltimateAnswer';
handle remainder => sub {
return unless ($_ eq '' || $_ eq '?');
return 'Forty-two', html => '<span style="font-size: 1.5em; font-weight: 400;">Forty-two</span>';
};
1;

24
t/UltimateAnswer.t Normal file
View File

@ -0,0 +1,24 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => "UltimateAnswer";
ddg_goodie_test(
[
'DDG::Goodie::UltimateAnswer'
],
'what is the ultimate answer to life the universe and everything'=>
test_zci(
'Forty-two', html => '<span style="font-size: 1.5em; font-weight: 400;">Forty-two</span>'
),
'what is the answer to my homework question' => undef,
'why?' => undef,
);
done_testing;