File: test.pl

package info (click to toggle)
libdate-holidays-de-perl 2.07-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 124 kB
  • sloc: perl: 324; makefile: 2
file content (61 lines) | stat: -rwxr-xr-x 1,253 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl

use Test::More;

BEGIN { use_ok('Date::Holidays::DE') or die; };

use Date::Holidays::DE qw<holidays>;

{
    my $feiertage_ref = holidays(
        YEAR=>2017,
        FORMAT=>"%d.%m.%Y",
    );
    is (
        scalar (grep { $_ eq '31.10.2017' } @$feiertage_ref),
        1,
        '2017: refo is a nation-wide holiday',
    );
}
{
    my $feiertage_ref = holidays(
        YEAR=>2017,
        WHERE=>['hh'],
        FORMAT=>"%d.%m.%Y",
    );
    is_deeply ($feiertage_ref, [], '2017: refo is NOT a local holiday in HH');
}
{
    my $feiertage_ref = holidays(
        YEAR=>2018,
        WHERE=>['hh'],
        FORMAT=>"%d.%m.%Y",
    );
    is_deeply (
        $feiertage_ref,
        [ qw<31.10.2018> ],
        '2018: refo is a local holiday in HH',
    );
}
{
    my $feiertage_ref = holidays(
        YEAR=>2018,
        WHERE=>['be'],
        FORMAT=>"%d.%m.%Y",
    );
    is_deeply ($feiertage_ref, [], '2018: frau is NOT a local holiday in Berlin');
}
{
    my $feiertage_ref = holidays(
        YEAR=>2019,
        WHERE=>['be'],
        FORMAT=>"%d.%m.%Y",
    );
    is (
        scalar (grep { $_ eq '08.03.2019' } @$feiertage_ref),
        1,
        '2019: frau is a local holiday in Berlin',
    );
}

done_testing;