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