[Bps-public-commit] r9683 - in Date-Extract: .

sartak at bestpractical.com sartak at bestpractical.com
Thu Nov 15 21:41:24 EST 2007


Author: sartak
Date: Thu Nov 15 21:41:23 2007
New Revision: 9683

Modified:
   Date-Extract/   (props changed)
   Date-Extract/t/02-extract.t

Log:
 r45241 at onn:  sartak | 2007-11-15 21:39:55 -0500
 Test fixes. Calendars are handy.


Modified: Date-Extract/t/02-extract.t
==============================================================================
--- Date-Extract/t/02-extract.t	(original)
+++ Date-Extract/t/02-extract.t	Thu Nov 15 21:41:23 2007
@@ -1,14 +1,14 @@
 #!perl -T
 use strict;
 use warnings;
-use Test::More tests => 48;
+use Test::More tests => 50;
 use Test::MockTime 'set_fixed_time';
 use Date::Extract;
 
 # a Friday. The time I wrote this line of code, in fact (in UTC)
 set_fixed_time('2007-08-03T05:36:52Z');
 
-my $parser = Date::Extract->new(prefer_future => 1);
+my $parser = Date::Extract->new(prefers => 'future', time_zone => 'America/New_York');
 
 sub extract_is {
     my ($in, $expected) = @_;
@@ -16,6 +16,8 @@
 
     my $dt = $parser->extract($in);
     is($dt->ymd, $expected, "extracts '$in' to $expected");
+
+    local $TODO = '';
     is($dt->time_zone->name, 'America/New_York', "correct time zone");
 }
 
@@ -31,24 +33,29 @@
 extract_is("tuesday"   => "2007-08-07");
 extract_is("wednesday" => "2007-08-08");
 extract_is("thursday"  => "2007-08-09");
-extract_is("friday"    => "2007-08-10");
+
+extract_is("friday"    => "2007-08-03");
+TODO: {
+    local $TODO = "DTFN bug. on friday, friday + prefer_future = today";
+    extract_is("friday"    => "2007-08-10");
+}
 # }}}
 # "last" days of the week {{{
+extract_is("last monday"    => "2007-07-23");
+extract_is("last tuesday"   => "2007-07-24");
+extract_is("last wednesday" => "2007-07-25");
+extract_is("last thursday"  => "2007-07-26");
 extract_is("last friday"    => "2007-07-27");
 extract_is("last saturday"  => "2007-07-28");
 extract_is("last sunday"    => "2007-07-29");
-extract_is("last monday"    => "2007-07-30");
-extract_is("last tuesday"   => "2007-07-31");
-extract_is("last wednesday" => "2007-08-01");
-extract_is("last thursday"  => "2007-08-02");
 # }}}
 # "next" days of the week {{{
-extract_is("next saturday"  => "2007-08-05");
-extract_is("next sunday"    => "2007-08-06");
-extract_is("next monday"    => "2007-08-07");
-extract_is("next tuesday"   => "2007-08-08");
-extract_is("next wednesday" => "2007-08-09");
-extract_is("next thursday"  => "2007-08-10");
-extract_is("next friday"    => "2007-08-11");
+extract_is("next monday"    => "2007-08-06");
+extract_is("next tuesday"   => "2007-08-07");
+extract_is("next wednesday" => "2007-08-08");
+extract_is("next thursday"  => "2007-08-09");
+extract_is("next friday"    => "2007-08-10");
+extract_is("next saturday"  => "2007-08-11");
+extract_is("next sunday"    => "2007-08-12");
 # }}}
 



More information about the Bps-public-commit mailing list