From a3714a56c846a58e5ad30445be29d0a3f09fd8f4 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Tue, 8 May 2012 10:49:54 -0600 Subject: [PATCH] tests for ParseCron --- t/10-combined.t | 3 +++ t/ParseCron.t | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 t/ParseCron.t diff --git a/t/10-combined.t b/t/10-combined.t index 7812571698f..421e6fc5f4c 100644 --- a/t/10-combined.t +++ b/t/10-combined.t @@ -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), diff --git a/t/ParseCron.t b/t/ParseCron.t new file mode 100644 index 00000000000..663c0f914b0 --- /dev/null +++ b/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; + +