Skip to content

Commit

Permalink
tests for ParseCron
Browse files Browse the repository at this point in the history
  • Loading branch information
crazedpsyc committed May 8, 2012
1 parent f2b5ade commit a3714a5
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions t/10-combined.t
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down
21 changes: 21 additions & 0 deletions t/ParseCron.t
@@ -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;


0 comments on commit a3714a5

Please sign in to comment.