Debian Codegraph @

t/date.list_holidays.3.t

raw
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-01-00:00:00,America/New_York");
11 $obj->config("ConfigFile","Holidays.3.cnf");
12
13 sub test {
14 my(@test)=@_;
15 my @date = $obj->list_holidays(@test);
16 my @ret = ();
17 foreach my $date (@date) {
18 my $d = $date->value();
19 my @h = $date->holiday();
20 foreach my $h (@h) {
21 push(@ret,"$d = $h");
22 }
23 }
24 return @ret;
25 }
26
27 my $tests="
28
29 2010
30 =>
31 '2010010100:00:00 = New Years Day (observed)'
32 '2010010100:00:00 = New Years Day'
33 '2010061700:00:00 = Bunker Hill Day'
34 '2010062000:00:00 = Father's Day'
35 '2010110200:00:00 = Election Day'
36 '2010110200:00:00 = Day of the Dead'
37 '2010123100:00:00 = New Years Day (observed)'
38
39 2012
40 =>
41 '2012010100:00:00 = New Years Day'
42 '2012010200:00:00 = New Years Day (observed)'
43 '2012061700:00:00 = Father's Day'
44 '2012061700:00:00 = Bunker Hill Day'
45 '2012110200:00:00 = Day of the Dead'
46 '2012110600:00:00 = Election Day'
47
48 ";
49
50 $::ti->tests(func => \&test,
51 tests => $tests);
52 $::ti->done_testing();
53
54 #Local Variables:
55 #mode: cperl
56 #indent-tabs-mode: nil
57 #cperl-indent-level: 3
58 #cperl-continued-statement-offset: 2
59 #cperl-continued-brace-offset: 0
60 #cperl-brace-offset: 0
61 #cperl-brace-imaginary-offset: 0
62 #cperl-label-offset: 0
63 #End: