Commit | Line | Data |
0a87afc4 |
1 | use warnings; |
2 | use strict; |
3 | |
4 | use Test::More; |
7e1ca6dd |
5 | use File::Glob 'bsd_glob'; |
0a87afc4 |
6 | use lib 't/lib'; |
7 | use DBICTest; |
8 | |
d146b340 |
9 | require DBIx::Class; |
10 | unless ( DBIx::Class::Optional::Dependencies->req_ok_for ('test_eol') ) { |
11 | my $missing = DBIx::Class::Optional::Dependencies->req_missing_for ('test_eol'); |
20884f55 |
12 | $ENV{RELEASE_TESTING} |
d146b340 |
13 | ? die ("Failed to load release-testing module requirements: $missing") |
14 | : plan skip_all => "Test needs: $missing" |
0a87afc4 |
15 | } |
16 | |
7e1ca6dd |
17 | # FIXME - temporary workaround for RT#82032 |
18 | { |
19 | no warnings 'redefine'; |
20 | *Test::EOL::_is_perl_module = sub { |
21 | $_[0] =~ /\.(?:pm|pod)$/i || $_[0] =~ /::/; |
22 | } |
23 | } |
24 | |
8273e845 |
25 | Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 }, |
95252a8c |
26 | qw/t xt lib script examples maint/, |
8273e845 |
27 | ); |
0a87afc4 |
28 | |
7e1ca6dd |
29 | # check some non-"perl files" in the root separately |
30 | # use .gitignore as a guide of what to skip |
31 | # (or do not test at all if no .gitignore is found) |
32 | if (open(my $gi, '<', '.gitignore')) { |
33 | my $skipnames; |
34 | while (my $ln = <$gi>) { |
35 | next if $ln =~ /^\s*$/; |
36 | chomp $ln; |
37 | $skipnames->{$_}++ for bsd_glob($ln); |
38 | } |
39 | |
40 | for my $fn (bsd_glob('*')) { |
41 | next if $skipnames->{$fn}; |
42 | next unless -f $fn; |
43 | Test::EOL::eol_unix_ok($fn, { trailing_whitespace => 1 }); |
44 | } |
45 | } |
a8b66abc |
46 | |
8273e845 |
47 | # FIXME - Test::EOL declares 'no_plan' which conflicts with done_testing |
48 | # https://github.com/schwern/test-more/issues/14 |
d146b340 |
49 | #done_testing; |