1use 5.006; 2use strict; 3use warnings; 4 5# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.052 6 7use Test::More; 8 9plan tests => 24 + ($ENV{AUTHOR_TESTING} ? 1 : 0); 10 11my @module_files = ( 12 'Bread/Board.pm', 13 'Bread/Board/BlockInjection.pm', 14 'Bread/Board/ConstructorInjection.pm', 15 'Bread/Board/Container.pm', 16 'Bread/Board/Container/FromParameterized.pm', 17 'Bread/Board/Container/Parameterized.pm', 18 'Bread/Board/Dependency.pm', 19 'Bread/Board/Dumper.pm', 20 'Bread/Board/LifeCycle.pm', 21 'Bread/Board/LifeCycle/Singleton.pm', 22 'Bread/Board/LifeCycle/Singleton/WithParameters.pm', 23 'Bread/Board/Literal.pm', 24 'Bread/Board/Service.pm', 25 'Bread/Board/Service/Alias.pm', 26 'Bread/Board/Service/Deferred.pm', 27 'Bread/Board/Service/Deferred/Thunk.pm', 28 'Bread/Board/Service/Inferred.pm', 29 'Bread/Board/Service/WithClass.pm', 30 'Bread/Board/Service/WithConstructor.pm', 31 'Bread/Board/Service/WithDependencies.pm', 32 'Bread/Board/Service/WithParameters.pm', 33 'Bread/Board/SetterInjection.pm', 34 'Bread/Board/Traversable.pm', 35 'Bread/Board/Types.pm' 36); 37 38 39 40# no fake home requested 41 42my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; 43 44use File::Spec; 45use IPC::Open3; 46use IO::Handle; 47 48open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; 49 50my @warnings; 51for my $lib (@module_files) 52{ 53 # see L<perlfaq8/How can I capture STDERR from an external command?> 54 my $stderr = IO::Handle->new; 55 56 my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); 57 binmode $stderr, ':crlf' if $^O eq 'MSWin32'; 58 my @_warnings = <$stderr>; 59 waitpid($pid, 0); 60 is($?, 0, "$lib loaded ok"); 61 62 if (@_warnings) 63 { 64 warn @_warnings; 65 push @warnings, @_warnings; 66 } 67} 68 69 70 71is(scalar(@warnings), 0, 'no warnings found') 72 or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; 73 74 75