[Bps-public-commit] r13095 - in Date-Extract: .
sartak at bestpractical.com
sartak at bestpractical.com
Mon Jun 9 19:32:34 EDT 2008
Author: sartak
Date: Mon Jun 9 19:32:33 2008
New Revision: 13095
Modified:
Date-Extract/ (props changed)
Date-Extract/t/04-formats.t
Log:
r61907 at onn: sartak | 2008-06-09 19:32:05 -0400
Finish the format tests. DTFN doesn't handle everything we give it. :(
Modified: Date-Extract/t/04-formats.t
==============================================================================
--- Date-Extract/t/04-formats.t (original)
+++ Date-Extract/t/04-formats.t Mon Jun 9 19:32:33 2008
@@ -12,38 +12,47 @@
'yesterday' =>
sub { is($_->ymd, DateTime->today->add(days => -1)->ymd, "yesterday") },
'last Friday' =>
- sub {},
+ sub {
+ is($_->day_name, 'Friday', "last Friday");
+ cmp_ok($_->epoch, '<', DateTime->today->epoch, "last Friday");
+ },
'next Monday' =>
- sub {},
+ sub {
+ is($_->day_name, 'Monday', "next Monday");
+ cmp_ok($_->epoch, '>', DateTime->today->epoch, "next Monday");
+ },
'previous Sat' =>
- sub {},
+ sub {
+ is($_->day_name, 'Saturday', "previous Sat");
+ cmp_ok($_->epoch, '<', DateTime->today->epoch, "previous Sat");
+ },
'Monday' =>
- sub {},
+ sub { is($_->day_name, 'Monday', "previous Sat") },
'Mon' =>
- sub {},
+ sub { is($_->day_name, 'Mon', "previous Sat") },
'November 13th, 1986' =>
- sub {},
+ sub { is($_->ymd, '1986-11-13', "November 13th, 1986") },
'Nov 13, 1986' =>
- sub {},
+ sub { is($_->ymd, '1986-11-13', "Nov 13th, 1986") },
'November 13th' =>
- sub {},
+ sub { is($_->ymd, DateTime->today->year . '-11-13', "November 13th") },
'Nov 13' =>
- sub {},
+ sub { is($_->ymd, DateTime->today->year . '-11-13', "Nov 13") },
'13 Nov' =>
- sub {},
+ sub { is($_->ymd, DateTime->today->year . '-11-13', "13 Nov") },
'13th November' =>
- sub {},
+ sub { is($_->ymd, DateTime->today->year . '-11-13', "13th November") },
'1986/11/13' =>
- sub {},
+ sub { is($_->ymd, '1986-11-13', "1986/11/13") },
'1986-11-13' =>
- sub {},
+ sub { is($_->ymd, '1986-11-13', "1986-11-13") },
'11-13-86' =>
- sub {},
+ sub { is($_->ymd, '1986-11-13', "11-13-86") },
'11/13/1986' =>
- sub {},
+ sub { is($_->ymd, '1986-11-13', "11/13/1986") },
);
-plan tests => 2 * keys(%formats);
+plan tests => 3 + 2 * keys(%formats);
while (my ($input, $checker) = each %formats) {
my $got = Date::Extract->extract($input);
More information about the Bps-public-commit
mailing list