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