Commit | Line | Data |
c0329273 |
1 | BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) } |
cb551b07 |
2 | use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_whitespace'; |
3 | |
0a87afc4 |
4 | use warnings; |
5 | use strict; |
6 | |
7 | use Test::More; |
7e1ca6dd |
8 | use File::Glob 'bsd_glob'; |
c0329273 |
9 | |
f892e7e4 |
10 | use DBICTest ':GlobalLock'; |
0a87afc4 |
11 | |
ffce4b65 |
12 | # FIXME - temporary workaround for RT#82032, RT#82033 |
331886ef |
13 | # also add all scripts (no extension) and some extra extensions |
14 | # we want to check |
7e1ca6dd |
15 | { |
16 | no warnings 'redefine'; |
ffce4b65 |
17 | my $is_pm = sub { |
ffaf1f82 |
18 | $_[0] !~ /\./ || $_[0] =~ /\.(?:pm|pod|skip|bash|sql|json|proto)$/i || $_[0] =~ /::/; |
ffce4b65 |
19 | }; |
331886ef |
20 | |
ffce4b65 |
21 | *Test::EOL::_is_perl_module = $is_pm; |
22 | *Test::NoTabs::_is_perl_module = $is_pm; |
7e1ca6dd |
23 | } |
24 | |
ffce4b65 |
25 | my @pl_targets = qw/t xt lib script examples maint/; |
26 | Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 }, @pl_targets); |
27 | Test::NoTabs::all_perl_files_ok(@pl_targets); |
0a87afc4 |
28 | |
7e1ca6dd |
29 | # check some non-"perl files" in the root separately |
1fb834df |
30 | my @root_files = grep { -f $_ } bsd_glob('*'); |
31 | |
32 | # use .gitignore as a partial guide of what to skip |
7e1ca6dd |
33 | if (open(my $gi, '<', '.gitignore')) { |
34 | my $skipnames; |
35 | while (my $ln = <$gi>) { |
36 | next if $ln =~ /^\s*$/; |
37 | chomp $ln; |
38 | $skipnames->{$_}++ for bsd_glob($ln); |
39 | } |
40 | |
1fb834df |
41 | # these we want to check no matter what the above says |
bd52af73 |
42 | delete @{$skipnames}{qw( |
1fb834df |
43 | Changes |
44 | LICENSE |
45 | AUTHORS |
46 | README |
47 | MANIFEST |
48 | META.yml |
49 | META.json |
50 | )}; |
51 | |
52 | @root_files = grep { ! $skipnames->{$_} } @root_files; |
53 | } |
ffce4b65 |
54 | |
1fb834df |
55 | for my $fn (@root_files) { |
56 | Test::EOL::eol_unix_ok($fn, { trailing_whitespace => 1 }); |
57 | Test::NoTabs::notabs_ok($fn) unless $fn eq 'MANIFEST'; # it is always tab infested |
7e1ca6dd |
58 | } |
a8b66abc |
59 | |
ffce4b65 |
60 | # FIXME - Test::NoTabs and Test::EOL declare 'no_plan' which conflicts with done_testing |
8273e845 |
61 | # https://github.com/schwern/test-more/issues/14 |
d146b340 |
62 | #done_testing; |