RT#22364 (ASH) hopefully fixed with updated prereq
[dbsrgits/DBIx-Class-UUIDColumns.git] / t / strict.t
1 #!perl -wT\r
2 # $Id: strict.t 3236 2007-05-05 16:24:35Z claco $\r
3 use strict;\r
4 use warnings;\r
5 \r
6 BEGIN {\r
7     use lib 't/lib';\r
8     use DBIC::Test;\r
9     use File::Find;\r
10     use File::Basename;\r
11 \r
12     plan skip_all => 'set TEST_AUTHOR to enable this test' unless $ENV{TEST_AUTHOR};\r
13 \r
14     eval 'use Test::Strict';\r
15     plan skip_all => 'Test::Strict not installed' if $@;\r
16     plan skip_all => 'Need untaint in newer File::Find' if $] <= 5.006;\r
17 };\r
18 \r
19 ## I hope this can go away if Test::Strict or File::Find::Rule\r
20 ## finally run under -T. Until then, I'm on my own here. ;-)\r
21 my @files;\r
22 my %trusted = (\r
23 \r
24 );\r
25 \r
26 find({  wanted => \&wanted,\r
27         untaint => 1,\r
28         untaint_pattern => qr|^([-+@\w./]+)$|,\r
29         untaint_skip => 1,\r
30         no_chdir => 1\r
31 }, qw(lib t));\r
32 \r
33 sub wanted {\r
34     my $name = $File::Find::name;\r
35     my $file = fileparse($name);\r
36 \r
37     return if $name =~ /TestApp/;\r
38 \r
39     if ($name =~ /\.(pm|pl|t)$/i && !exists($trusted{$file})) {\r
40         push @files, $name;\r
41     };\r
42 };\r
43 \r
44 if (scalar @files) {\r
45     plan tests => scalar @files;\r
46 } else {\r
47     plan tests => 1;\r
48     fail 'No perl files found for Test::Strict checks!';\r
49 };\r
50 \r
51 foreach (@files) {\r
52     strict_ok($_);\r
53 };\r