| 1 | use 5.006scip-perl cpan WWW-Shorten-5gp 1.030 `5.006`/; |
| 2 | use strictscip-perl cpan WWW-Shorten-5gp 1.030 strict/; |
| 3 | use warningsscip-perl cpan WWW-Shorten-5gp 1.030 warnings/; |
| 4 | |
| 5 | # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 |
| 6 | |
| 7 | use Test::Morescip-perl cpan WWW-Shorten-5gp 1.030 Test/More/; |
| 8 | |
| 9 | planscip-perl cpan WWW-Shorten-5gp 1.030 main/plan(). tests => 2; |
| 10 | |
| 11 | my @module_files = ( |
| 12 | 'WWW/Shorten/5gp.pm' |
| 13 | ); |
| 14 | |
| 15 | |
| 16 | |
| 17 | # no fake home requested |
| 18 | |
| 19 | my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; |
| 20 | |
| 21 | use File::Specscip-perl cpan WWW-Shorten-5gp 1.030 File/Spec/; |
| 22 | use IPC::Open3scip-perl cpan WWW-Shorten-5gp 1.030 IPC/Open3/; |
| 23 | use IO::Handlescip-perl cpan WWW-Shorten-5gp 1.030 IO/Handle/; |
| 24 | |
| 25 | openscip-perl cpan WWW-Shorten-5gp 1.030 main/open(). my $stdin, '<', File::Spec->devnullscip-perl cpan WWW-Shorten-5gp 1.030 File/Spec/devnull(). or diescip-perl cpan WWW-Shorten-5gp 1.030 main/die(). "can't open devnull: $!"; |
| 26 | |
| 27 | my @warnings; |
| 28 | for my $lib (@module_files) |
| 29 | { |
| 30 | # see L<perlfaq8/How can I capture STDERR from an external command?> |
| 31 | my $stderr = IO::Handle->newscip-perl cpan WWW-Shorten-5gp 1.030 IO/Handle/new().; |
| 32 | |
| 33 | my $pid = open3scip-perl cpan WWW-Shorten-5gp 1.030 main/open3().($stdin, '>&STDERR', $stderr, $^Xscip-perl cpan WWW-Shorten-5gp 1.030 main/`$^X`., $inc_switch, '-e', "require q[$lib]"); |
| 34 | binmodescip-perl cpan WWW-Shorten-5gp 1.030 main/binmode(). $stderr, ':crlf' if $^Oscip-perl cpan WWW-Shorten-5gp 1.030 main/`$^O`. eq 'MSWin32'; |
| 35 | my @_warnings = <$stderr>; |
| 36 | waitpidscip-perl cpan WWW-Shorten-5gp 1.030 main/waitpid().($pid, 0); |
| 37 | isscip-perl cpan WWW-Shorten-5gp 1.030 main/is().($?scip-perl cpan WWW-Shorten-5gp 1.030 main/`$?`., 0, "$lib loaded ok"); |
| 38 | |
| 39 | shiftscip-perl cpan WWW-Shorten-5gp 1.030 main/shift(). @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ |
| 40 | and not eval { requirescip-perl cpan WWW-Shorten-5gp 1.030 main/require(). blib; blib->VERSIONscip-perl cpan WWW-Shorten-5gp 1.030 blib/VERSION().('1.01') }; |
| 41 | |
| 42 | if (@_warnings) |
| 43 | { |
| 44 | warnscip-perl cpan WWW-Shorten-5gp 1.030 main/warn(). @_warnings; |
| 45 | pushscip-perl cpan WWW-Shorten-5gp 1.030 main/push(). @warnings, @_warnings; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | |
| 50 | |
| 51 | isscip-perl cpan WWW-Shorten-5gp 1.030 main/is().(scalarscip-perl cpan WWW-Shorten-5gp 1.030 main/scalar().(@warnings), 0, 'no warnings found') |
| 52 | or diagscip-perl cpan WWW-Shorten-5gp 1.030 main/diag(). 'got warnings: ', ( Test::More->canscip-perl cpan WWW-Shorten-5gp 1.030 Test/More/can().('explain') ? Test::More::explainscip-perl cpan WWW-Shorten-5gp 1.030 Test/More/explain().(\@warnings) : joinscip-perl cpan WWW-Shorten-5gp 1.030 main/join().("\n", '', @warnings) ); |
| 53 | |
| 54 |