]> Dogcows Code - chaz/p5-HTTP-AnyUA/blob - t/00-compile.t
Version 0.900
[chaz/p5-HTTP-AnyUA] / t / 00-compile.t
1 use 5.006;
2 use strict;
3 use warnings;
4
5 # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.056
6
7 use Test::More;
8
9 plan tests => 10 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
10
11 my @module_files = (
12 'HTTP/AnyUA.pm',
13 'HTTP/AnyUA/Backend.pm',
14 'HTTP/AnyUA/Backend/AnyEvent/HTTP.pm',
15 'HTTP/AnyUA/Backend/Furl.pm',
16 'HTTP/AnyUA/Backend/HTTP/AnyUA.pm',
17 'HTTP/AnyUA/Backend/HTTP/Tiny.pm',
18 'HTTP/AnyUA/Backend/LWP/UserAgent.pm',
19 'HTTP/AnyUA/Backend/Mojo/UserAgent.pm',
20 'HTTP/AnyUA/Backend/Net/Curl/Easy.pm',
21 'HTTP/AnyUA/Util.pm'
22 );
23
24
25
26 # no fake home requested
27
28 my @switches = (
29 -d 'blib' ? '-Mblib' : '-Ilib',
30 );
31
32 use File::Spec;
33 use IPC::Open3;
34 use IO::Handle;
35
36 open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
37
38 my @warnings;
39 for my $lib (@module_files)
40 {
41 # see L<perlfaq8/How can I capture STDERR from an external command?>
42 my $stderr = IO::Handle->new;
43
44 diag('Running: ', join(', ', map { my $str = $_; $str =~ s/'/\\'/g; q{'} . $str . q{'} }
45 $^X, @switches, '-e', "require q[$lib]"))
46 if $ENV{PERL_COMPILE_TEST_DEBUG};
47
48 my $pid = open3($stdin, '>&STDERR', $stderr, $^X, @switches, '-e', "require q[$lib]");
49 binmode $stderr, ':crlf' if $^O eq 'MSWin32';
50 my @_warnings = <$stderr>;
51 waitpid($pid, 0);
52 is($?, 0, "$lib loaded ok");
53
54 shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/
55 and not eval { require blib; blib->VERSION('1.01') };
56
57 if (@_warnings)
58 {
59 warn @_warnings;
60 push @warnings, @_warnings;
61 }
62 }
63
64
65
66 is(scalar(@warnings), 0, 'no warnings found')
67 or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
68
69
This page took 0.033943 seconds and 4 git commands to generate.