Debian Codegraph @

t/date.parse_date.misc.0.t

raw symbols SCIP
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5 use Test::Inter;
6 $::ti = new Test::Inter $0;
7 require "tests.pl";
8
9 our $obj = new Date::Manip::Date;
10 $obj->config("forcedate","2000-01-21-00:00:00,America/New_York");
11
12 sub test {
13 my(@test)=@_;
14 if ($test[0] eq "config") {
15 shift(@test);
16 $obj->config(@test);
17 return ();
18 }
19
20 $obj->_init();
21 my $err = $obj->parse_date(@test);
22 if ($err) {
23 return $obj->err();
24 } else {
25 my $d1 = $obj->value();
26 my $d2 = $obj->value("gmt");
27 return($d1,$d2);
28 }
29 }
30
31 my $tests="
32
33 Friday => 2000012100:00:00 2000012105:00:00
34
35 Monday => 2000011700:00:00 2000011705:00:00
36
37 Saturday => 2000012200:00:00 2000012205:00:00
38
39 'next year' => 2001012100:00:00 2001012105:00:00
40
41 'last year' => 1999012100:00:00 1999012105:00:00
42
43 'next month' => 2000022100:00:00 2000022105:00:00
44
45 'last month' => 1999122100:00:00 1999122105:00:00
46
47 'next week' => 2000012800:00:00 2000012805:00:00
48
49 'last week' => 2000011400:00:00 2000011405:00:00
50
51 'next friday' => 2000012800:00:00 2000012805:00:00
52
53 'next sunday' => 2000012300:00:00 2000012305:00:00
54
55 'last friday' => 2000011400:00:00 2000011405:00:00
56
57 'last sunday' => 2000011600:00:00 2000011605:00:00
58
59 'last tue in Jun 96' => 1996062500:00:00 1996062504:00:00
60
61 'last tueSday of Jan' => 2000012500:00:00 2000012505:00:00
62
63 'last day in October 1997' => 1997103100:00:00 1997103105:00:00
64
65 ";
66
67 $::ti->tests(func => \&test,
68 tests => $tests);
69 $::ti->done_testing();
70
71 #Local Variables:
72 #mode: cperl
73 #indent-tabs-mode: nil
74 #cperl-indent-level: 3
75 #cperl-continued-statement-offset: 2
76 #cperl-continued-brace-offset: 0
77 #cperl-brace-offset: 0
78 #cperl-brace-imaginary-offset: 0
79 #cperl-label-offset: 0
80 #End: