Commit | Line | Data |
494e0205 |
1 | use DBIx::Class::Schema::Loader::Optional::Dependencies |
2 | -skip_all_without => 'test_whitespace'; |
3 | |
4 | use warnings; |
5 | use strict; |
6 | |
7 | use Test::More; |
8 | use File::Glob 'bsd_glob'; |
9 | use lib 't/lib'; |
10 | |
11 | # FIXME - temporary workaround for RT#82032, RT#82033 |
12 | # also add all scripts (no extension) and some extra extensions |
13 | # we want to check |
14 | { |
15 | no warnings 'redefine'; |
16 | my $is_pm = sub { |
17 | $_[0] !~ /\./ || $_[0] =~ /\.(?:pm|pod|skip|bash|sql|json|proto)$/i || $_[0] =~ /::/; |
18 | }; |
19 | |
20 | *Test::EOL::_is_perl_module = $is_pm; |
21 | *Test::NoTabs::_is_perl_module = $is_pm; |
22 | } |
23 | |
24 | my @pl_targets = qw/t xt lib script maint/; |
25 | Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 }, @pl_targets); |
26 | Test::NoTabs::all_perl_files_ok(@pl_targets); |
27 | |
28 | # check some non-"perl files" in the root separately |
29 | # use .gitignore as a guide of what to skip |
30 | # (or do not test at all if no .gitignore is found) |
31 | if (open(my $gi, '<', '.gitignore')) { |
32 | my $skipnames; |
33 | while (my $ln = <$gi>) { |
34 | next if $ln =~ /^\s*$/; |
35 | chomp $ln; |
36 | $ln =~ s{^/}{}; |
37 | $skipnames->{$_}++ for bsd_glob($ln); |
38 | } |
39 | |
40 | # that we want to check anyway |
41 | delete $skipnames->{'META.yml'}; |
42 | |
43 | for my $fn (bsd_glob('*')) { |
44 | next if $skipnames->{$fn}; |
45 | next unless -f $fn; |
46 | Test::EOL::eol_unix_ok($fn, { trailing_whitespace => 1 }); |
47 | Test::NoTabs::notabs_ok($fn); |
48 | } |
49 | } |
50 | |
51 | # FIXME - Test::NoTabs and Test::EOL declare 'no_plan' which conflicts with done_testing |
52 | # https://github.com/schwern/test-more/issues/14 |
53 | #done_testing; |