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