Debian Codegraph @

t/00-compile.t

raw
1 use 5.006;
2 use strict;
3 use warnings;
4
5 # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
6
7 use Test::More;
8
9 plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
10
11 my @module_files = (
12 'Lingua/EN/Number/IsOrdinal.pm'
13 );
14
15
16
17 # no fake home requested
18
19 my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
20
21 use File::Spec;
22 use IPC::Open3;
23 use IO::Handle;
24
25 open my $stdin, '<', File::Spec->devnull or 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->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
48 is(scalar(@warnings), 0, 'no warnings found')
49 or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
50
51