~ubuntu-branches/ubuntu/trusty/libtest-roo-perl/trusty-proposed

« back to all changes in this revision

Viewing changes to t/00-compile.t

  • Committer: Package Import Robot
  • Author(s): gregor herrmann
  • Date: 2014-01-14 19:25:11 UTC
  • Revision ID: package-import@ubuntu.com-20140114192511-9ycl4dc1zgamfnek
Tags: upstream-1.002
ImportĀ upstreamĀ versionĀ 1.002

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use strict;
 
2
use warnings;
 
3
 
 
4
# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.033
 
5
 
 
6
use Test::More  tests => 4 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
 
7
 
 
8
 
 
9
 
 
10
my @module_files = (
 
11
    'Test/Roo.pm',
 
12
    'Test/Roo/Class.pm',
 
13
    'Test/Roo/Cookbook.pm',
 
14
    'Test/Roo/Role.pm'
 
15
);
 
16
 
 
17
 
 
18
 
 
19
# fake home for cpan-testers
 
20
use File::Temp;
 
21
local $ENV{HOME} = File::Temp::tempdir( CLEANUP => 1 );
 
22
 
 
23
 
 
24
use File::Spec;
 
25
use IPC::Open3;
 
26
use IO::Handle;
 
27
 
 
28
my @warnings;
 
29
for my $lib (@module_files)
 
30
{
 
31
    # see L<perlfaq8/How can I capture STDERR from an external command?>
 
32
    open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
 
33
    my $stderr = IO::Handle->new;
 
34
 
 
35
    my $pid = open3($stdin, '>&STDERR', $stderr, $^X, '-Mblib', '-e', "require q[$lib]");
 
36
    binmode $stderr, ':crlf' if $^O eq 'MSWin32';
 
37
    my @_warnings = <$stderr>;
 
38
    waitpid($pid, 0);
 
39
    is($? >> 8, 0, "$lib loaded ok");
 
40
 
 
41
    if (@_warnings)
 
42
    {
 
43
        warn @_warnings;
 
44
        push @warnings, @_warnings;
 
45
    }
 
46
}
 
47
 
 
48
 
 
49
 
 
50
is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
 
51
 
 
52