1use strict;
2use warnings;
3
4use Test::More;
5
6BEGIN {
7    plan skip_all => 'This test is only run for the module author'
8        unless -d '.hg' || $ENV{IS_MAINTAINER};
9}
10
11use File::Find::Rule;
12use Test::Pod::Coverage 1.04;
13
14my $dir = -d 'blib' ? 'blib' : 'lib';
15
16my @files = sort File::Find::Rule ->file->name('*.pm')
17    ->not( File::Find::Rule->grep('This file is auto-generated') )->in($dir);
18
19plan tests => scalar @files;
20
21for my $file (@files) {
22    ( my $mod = $file ) =~ s/^.+(DateTime.+)\.pm$/$1/;
23    $mod =~ s{/}{::}g;
24
25    my @trustme = qr/^STORABLE_/;
26    if ( $mod eq 'DateTime::Locale::Base' ) {
27
28        # This is mostly the backwards compatibility cruft.
29        push @trustme, (
30            map {qr/^\Q$_\E$/}
31                qw( new
32
33                month_name
34                month_abbreviation
35                month_narrow
36
37                month_names
38                month_abbreviations
39                month_narrows
40
41                day_name
42                day_abbreviation
43                day_narrow
44
45                day_names
46                day_abbreviations
47                day_narrows
48
49                quarter_name
50                quarter_abbreviation
51                quarter_narrow
52
53                quarter_names
54                quarter_abbreviations
55
56                am_pm
57                am_pms
58
59                era_name
60                era_abbreviation
61                era_narrow
62
63                era_names
64                era_abbreviations
65
66                era
67                eras
68
69                date_before_time
70                date_parts_order
71
72                full_date_format
73                long_date_format
74                medium_date_format
75                short_date_format
76                default_date_format
77
78                full_time_format
79                long_time_format
80                medium_time_format
81                short_time_format
82                default_time_format
83
84                full_datetime_format
85                long_datetime_format
86                medium_datetime_format
87                short_datetime_format
88                default_datetime_format
89                )
90        );
91    }
92
93    pod_coverage_ok( $mod, { trustme => \@trustme } );
94}
95