"Fossies" - the Fresh Open Source Software Archive

Member "MIME-Base64-3.16/xt/author/00-compile.t" (27 Sep 2020, 1406 Bytes) of package /linux/privat/MIME-Base64-3.16.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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