Debian Codegraph @

t/date.parse.timezone.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","2013-10-04-00:00:00,America/New_York");
11
12 sub test {
13 my(@test)=@_;
14 my $err = $obj->parse(@test);
15 if ($err) {
16 return $obj->err();
17 } else {
18 my $out = $obj->printf("%g");
19 return($out);
20 }
21 }
22
23 my $tests="
24
25 'today at midnight UTC' => 'Fri, 04 Oct 2013 00:00:00 UTC'
26
27 'today at midnight' => 'Fri, 04 Oct 2013 00:00:00 EDT'
28
29 'yesterday at midnight UTC' => 'Thu, 03 Oct 2013 00:00:00 UTC'
30
31 'yesterday at midnight' => 'Thu, 03 Oct 2013 00:00:00 EDT'
32
33 '1st at midnight UTC' => 'Tue, 01 Oct 2013 00:00:00 UTC'
34
35 '1st at midnight' => 'Tue, 01 Oct 2013 00:00:00 EDT'
36
37 'last month at midnight UTC' => 'Wed, 04 Sep 2013 00:00:00 UTC'
38
39 'last month at midnight' => 'Wed, 04 Sep 2013 00:00:00 EDT'
40
41 '0 day ago at midnight UTC' => 'Fri, 04 Oct 2013 00:00:00 UTC'
42
43 '0 day ago at midnight' => 'Fri, 04 Oct 2013 00:00:00 EDT'
44
45 '1 day ago at midnight UTC' => 'Thu, 03 Oct 2013 00:00:00 UTC'
46
47 '1 day ago at midnight' => 'Thu, 03 Oct 2013 00:00:00 EDT'
48
49 ";
50
51 $::ti->tests(func => \&test,
52 tests => $tests);
53 $::ti->done_testing();
54
55 #Local Variables:
56 #mode: cperl
57 #indent-tabs-mode: nil
58 #cperl-indent-level: 3
59 #cperl-continued-statement-offset: 2
60 #cperl-continued-brace-offset: 0
61 #cperl-brace-offset: 0
62 #cperl-brace-imaginary-offset: 0
63 #cperl-label-offset: 0
64 #End: