tests for ParseCron

master
Michael Smith 2012-05-08 10:49:54 -06:00
parent f2b5adef5e
commit a3714a56c8
2 changed files with 24 additions and 0 deletions

View File

@ -27,6 +27,7 @@ ddg_goodie_test(
DDG::Goodie::HTMLEntities
DDG::Goodie::NLetterWords
DDG::Goodie::Palindrome
DDG::Goodie::ParseCron
DDG::Goodie::Passphrase
DDG::Goodie::PercentError
DDG::Goodie::Perimeter
@ -110,6 +111,8 @@ ddg_goodie_test(
'is foo a palindrome?' => test_zci('foo is not a palindrome.', answer_type=>'palindrome', is_cached=>1),
'is foof a palindrome?' => test_zci('foof is a palindrome.', answer_type=>'palindrome', is_cached=>1),
# ParseCron
'crontab * */3 * * *' => test_zci(qr/^Event will start next at \d{2}:\d{2}:\d{2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/, answer_type=>'parsecron', is_cached=>0),
# Passphrase
'passphrase 4 words' => test_zci(qr/random passphrase:/, answer_type => 'passphrase', is_cached => 0),

21
t/ParseCron.t Normal file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => 'parsecron';
zci is_cached => 0;
ddg_goodie_test(
[qw(
DDG::Goodie::ParseCron
)],
'crontab * */3 * * *' => test_zci(qr/^Event will start next at \d{2}:\d{2}:\d{2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
'crontab 42 12 3 Feb Sat' => test_zci(qr/^Event will start next at \d{2}:\d{2}:\d{2} on \d{1,2} [a-zA-Z]{3}, \d{4}$/),
);
done_testing;