Move a number of tests to xt, restructure extra lists
[dbsrgits/DBIx-Class.git] / xt / dist / postdistdir / whitespace.t
CommitLineData
cb551b07 1use DBIx::Class::Optional::Dependencies -skip_all_without => 'test_whitespace';
2
0a87afc4 3use warnings;
4use strict;
5
6use Test::More;
7e1ca6dd 7use File::Glob 'bsd_glob';
0a87afc4 8use lib 't/lib';
f892e7e4 9use DBICTest ':GlobalLock';
0a87afc4 10
ffce4b65 11# FIXME - temporary workaround for RT#82032, RT#82033
331886ef 12# also add all scripts (no extension) and some extra extensions
13# we want to check
7e1ca6dd 14{
15 no warnings 'redefine';
ffce4b65 16 my $is_pm = sub {
ffaf1f82 17 $_[0] !~ /\./ || $_[0] =~ /\.(?:pm|pod|skip|bash|sql|json|proto)$/i || $_[0] =~ /::/;
ffce4b65 18 };
331886ef 19
ffce4b65 20 *Test::EOL::_is_perl_module = $is_pm;
21 *Test::NoTabs::_is_perl_module = $is_pm;
7e1ca6dd 22}
23
ffce4b65 24my @pl_targets = qw/t xt lib script examples maint/;
25Test::EOL::all_perl_files_ok({ trailing_whitespace => 1 }, @pl_targets);
26Test::NoTabs::all_perl_files_ok(@pl_targets);
0a87afc4 27
7e1ca6dd 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)
31if (open(my $gi, '<', '.gitignore')) {
32 my $skipnames;
33 while (my $ln = <$gi>) {
34 next if $ln =~ /^\s*$/;
35 chomp $ln;
36 $skipnames->{$_}++ for bsd_glob($ln);
37 }
38
ffce4b65 39 # that we want to check anyway
40 delete $skipnames->{'META.yml'};
41
7e1ca6dd 42 for my $fn (bsd_glob('*')) {
43 next if $skipnames->{$fn};
44 next unless -f $fn;
45 Test::EOL::eol_unix_ok($fn, { trailing_whitespace => 1 });
ffce4b65 46 Test::NoTabs::notabs_ok($fn);
7e1ca6dd 47 }
48}
a8b66abc 49
ffce4b65 50# FIXME - Test::NoTabs and Test::EOL declare 'no_plan' which conflicts with done_testing
8273e845 51# https://github.com/schwern/test-more/issues/14
d146b340 52#done_testing;