1#!/usr/bin/perl 2 3use warnings; 4use strict; 5use Test::Inter; 6$::ti = new Test::Inter $0; 7require "tests.pl"; 8 9our $obj = new Date::Manip::Date; 10$obj->config("forcedate","2000-01-21-12:30:00,America/New_York"); 11 12sub test { 13 my(@test)=@_; 14 if ($test[0] eq "config") { 15 shift(@test); 16 $obj->config(@test); 17 return (); 18 } 19 20 my $err = $obj->parse(@test); 21 if ($err) { 22 return $obj->err(); 23 } else { 24 my $d1 = $obj->value(); 25 my $d2 = $obj->value("gmt"); 26 return($d1,$d2); 27 } 28} 29 30my $tests=" 31 32'in 3 days' => 2000012412:30:00 2000012417:30:00 33 34'in 3 days at 13:45:00' => 2000012413:45:00 2000012418:45:00 35 36'in 3 days 15 minutes' => 2000012412:45:00 2000012417:45:00 37 38'in 3 days 15 minutes at 13:50' => '[parse] Two times entered or implied' 39 40'in 3 weeks on Monday' => 2000020712:30:00 2000020717:30:00 41 42'in 3 weeks, Monday' => 2000020712:30:00 2000020717:30:00 43 44'in 3 weeks, Sunday' => 2000021312:30:00 2000021317:30:00 45 46'in 3 weeks, Sunday' => 2000021312:30:00 2000021317:30:00 47 48'2 weeks ago, Monday' => 2000010312:30:00 2000010317:30:00 49 50'2 weeks ago, Sunday' => 2000010912:30:00 2000010917:30:00 51 52'2 weeks ago, Sunday at 13:45' => 2000010913:45:00 2000010918:45:00 53 54'in one week' => 2000012812:30:00 2000012817:30:00 55 56'in 3 days PST' => 2000012412:30:00 2000012420:30:00 57 58"; 59 60$::ti->tests(func => \&test, 61 tests => $tests); 62$::ti->done_testing(); 63 64#Local Variables: 65#mode: cperl 66#indent-tabs-mode: nil 67#cperl-indent-level: 3 68#cperl-continued-statement-offset: 2 69#cperl-continued-brace-offset: 0 70#cperl-brace-offset: 0 71#cperl-brace-imaginary-offset: 0 72#cperl-label-offset: 0 73#End: 74