55df0df3d2484d90ffc0238b69b65a11be62a970
[dbsrgits/DBIx-Class.git] / t / 02_standalone_test_classes.t
1 use warnings;
2 use strict;
3
4 use Test::More;
5 use File::Find;
6
7 use lib 't/lib';
8
9 find({
10   wanted => sub {
11
12     return unless ( -f $_ and $_ =~ /\.pm$/ );
13
14     my $pid = fork();
15     if (! defined $pid) {
16       die "fork failed: $!"
17     }
18     elsif (!$pid) {
19       if (my @offenders = grep { $_ =~ /(^|\/)DBI/ } keys %INC) {
20         die "Wtf - DBI* modules present in %INC: @offenders";
21       }
22
23       local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /\bdeprecated\b/i };
24       require( ($_ =~ /(.+)/)[0] ); # untaint
25       exit 0;
26     }
27
28     is ( waitpid($pid, 0), $pid, "Fork $pid terminated sucessfully");
29     my $ex = $? >> 8;
30     is ( $ex, 0, "Loading $_ ($pid) exitted with $ex" );
31   },
32
33   no_chdir => 1,
34 }, 't/lib/DBICTest/Schema/');
35
36 done_testing;