| 1 |
use 5.006; |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.056 |
| 6 |
|
| 7 |
use Test::More; |
| 8 |
|
| 9 |
plan tests => 13; |
| 10 |
|
| 11 |
my @module_files = ( |
| 12 |
'Catalyst/Controller/HTML/FormFu.pm', |
| 13 |
'Catalyst/Controller/HTML/FormFu/Action/Form.pm', |
| 14 |
'Catalyst/Controller/HTML/FormFu/Action/FormConfig.pm', |
| 15 |
'Catalyst/Controller/HTML/FormFu/Action/FormMethod.pm', |
| 16 |
'Catalyst/Controller/HTML/FormFu/Action/MultiForm.pm', |
| 17 |
'Catalyst/Controller/HTML/FormFu/Action/MultiFormConfig.pm', |
| 18 |
'Catalyst/Controller/HTML/FormFu/Action/MultiFormMethod.pm', |
| 19 |
'Catalyst/Controller/HTML/FormFu/ActionBase/Form.pm', |
| 20 |
'Catalyst/Helper/HTML/FormFu.pm', |
| 21 |
'HTML/FormFu/Constraint/RequestToken.pm', |
| 22 |
'HTML/FormFu/Element/RequestToken.pm', |
| 23 |
'HTML/FormFu/Plugin/RequestToken.pm' |
| 24 |
); |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
# no fake home requested |
| 29 |
|
| 30 |
my @switches = ( |
| 31 |
-d 'blib' ? '-Mblib' : '-Ilib', |
| 32 |
); |
| 33 |
|
| 34 |
use File::Spec; |
| 35 |
use IPC::Open3; |
| 36 |
use IO::Handle; |
| 37 |
|
| 38 |
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; |
| 39 |
|
| 40 |
my @warnings; |
| 41 |
for my $lib (@module_files) |
| 42 |
{ |
| 43 |
# see L<perlfaq8/How can I capture STDERR from an external command?> |
| 44 |
my $stderr = IO::Handle->new; |
| 45 |
|
| 46 |
diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} } |
| 47 |
$^X, @switches, '-e', "require q[$lib]")) |
| 48 |
if $ENV{PERL_COMPILE_TEST_DEBUG}; |
| 49 |
|
| 50 |
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]"); |
| 51 |
binmode $stderr, ':crlf' if $^O eq 'MSWin32'; |
| 52 |
my @_warnings = <$stderr>; |
| 53 |
waitpid($pid, 0); |
| 54 |
is($?, 0, "$lib loaded ok"); |
| 55 |
|
| 56 |
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ |
| 57 |
and not eval { require blib; blib->VERSION('1.01') }; |
| 58 |
|
| 59 |
if (@_warnings) |
| 60 |
{ |
| 61 |
warn @_warnings; |
| 62 |
push @warnings, @_warnings; |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
is(scalar(@warnings), 0, 'no warnings found') |
| 69 |
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ); |
| 70 |
|
| 71 |
|