Debian Codegraph @

t/00-compile.t

raw symbols SCIP
1 use strict;
2 use warnings;
3
4 # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.059
5
6 use Test::More;
7
8 plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
9
10 my @module_files = (
11 'Config/IniFiles.pm'
12 );
13
14
15
16 # fake home for cpan-testers
17 use File::Temp;
18 local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );
19
20
21 my @switches = (
22 -d 'blib' ? '-Mblib' : '-Ilib',
23 );
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 diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'}.$str.q{'} }
38 $^X, @switches, '-e', "require q[$lib]"))
39 if $ENV{PERL_COMPILE_TEST_DEBUG};
40
41 my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
42 binmode $stderr, ':crlf' if $^O eq 'MSWin32';
43 my @_warnings = <$stderr>;
44 waitpid($pid, 0);
45 is($?, 0, "$lib loaded ok");
46
47 shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
48 and not eval { +require blib; blib->VERSION('1.01') };
49
50 if (@_warnings)
51 {
52 warn @_warnings;
53 push @warnings, @_warnings;
54 }
55 }
56
57
58
59 is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
60
61