Blame xt/author/00-compile.t
|
Packit |
92cec9 |
use 5.006;
|
|
Packit |
92cec9 |
use strict;
|
|
Packit |
92cec9 |
use warnings;
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
use Test::More;
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
plan tests => 2;
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
my @module_files = (
|
|
Packit |
92cec9 |
'Package/DeprecationManager.pm'
|
|
Packit |
92cec9 |
);
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
# no fake home requested
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
use File::Spec;
|
|
Packit |
92cec9 |
use IPC::Open3;
|
|
Packit |
92cec9 |
use IO::Handle;
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
my @warnings;
|
|
Packit |
92cec9 |
for my $lib (@module_files)
|
|
Packit |
92cec9 |
{
|
|
Packit |
92cec9 |
# see L<perlfaq8/How can I capture STDERR from an external command?>
|
|
Packit |
92cec9 |
my $stderr = IO::Handle->new;
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
|
|
Packit |
92cec9 |
binmode $stderr, ':crlf' if $^O eq 'MSWin32';
|
|
Packit |
92cec9 |
my @_warnings = <$stderr>;
|
|
Packit |
92cec9 |
waitpid($pid, 0);
|
|
Packit |
92cec9 |
is($?, 0, "$lib loaded ok");
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
|
|
Packit |
92cec9 |
and not eval { require blib; blib->VERSION('1.01') };
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
if (@_warnings)
|
|
Packit |
92cec9 |
{
|
|
Packit |
92cec9 |
warn @_warnings;
|
|
Packit |
92cec9 |
push @warnings, @_warnings;
|
|
Packit |
92cec9 |
}
|
|
Packit |
92cec9 |
}
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
is(scalar(@warnings), 0, 'no warnings found')
|
|
Packit |
92cec9 |
or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) );
|
|
Packit |
92cec9 |
|
|
Packit |
92cec9 |
|