| 1 |
use 5.006; |
| 2 |
use strict; |
| 3 |
use warnings; |
| 4 |
|
| 5 |
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.043 |
| 6 |
|
| 7 |
use Test::More tests => 2 + ($ENV{AUTHOR_TESTING} ? 1 : 0); |
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
my @module_files = ( |
| 12 |
'custom/failures.pm', |
| 13 |
'failures.pm' |
| 14 |
); |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
# fake home for cpan-testers |
| 19 |
use File::Temp; |
| 20 |
local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 ); |
| 21 |
|
| 22 |
|
| 23 |
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; |
| 24 |
|
| 25 |
use File::Spec; |
| 26 |
use IPC::Open3; |
| 27 |
use IO::Handle; |
| 28 |
|
| 29 |
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; |
| 30 |
|
| 31 |
my @warnings; |
| 32 |
for my $lib (@module_files) |
| 33 |
{ |
| 34 |
# see L<perlfaq8/How can I capture STDERR from an external command?> |
| 35 |
my $stderr = IO::Handle->new; |
| 36 |
|
| 37 |
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); |
| 38 |
binmode $stderr, ':crlf' if $^O eq 'MSWin32'; |
| 39 |
my @_warnings = <$stderr>; |
| 40 |
waitpid($pid, 0); |
| 41 |
is($?, 0, "$lib loaded ok"); |
| 42 |
|
| 43 |
if (@_warnings) |
| 44 |
{ |
| 45 |
warn @_warnings; |
| 46 |
push @warnings, @_warnings; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING}; |
| 53 |
|
| 54 |
|