}
}
+use Test;
+
+plan tests => 10;
+
my $STDOUT = './results-0';
my $STDERR = './results-1';
my $PERL = './perl';
my $FAILURE_CODE = 119;
-print "1..9\n";
-
# Run perl with specified environment and arguments returns a list.
# First element is true iff Perl's stdout and stderr match the
# supplied $stdout and $stderr argument strings exactly.
}
sub try {
- my $testno = shift;
my ($success, $reason) = runperl(@_);
- if ($success) {
- print "ok $testno\n";
- } else {
- $reason =~ s/\n/\\n/g;
- print "not ok $testno # $reason\n";
- }
+ $reason =~ s/\n/\\n/g if defined $reason;
+ ok( !!$success, 1, $reason );
}
# PERL5OPT Command-line options (switches). Switches in
# -T, tainting will be enabled, and any
# subsequent options ignored.
-my $T = 1;
-try($T++, {PERL5OPT => '-w'}, ['-e', 'print $::x'],
+try({PERL5OPT => '-w'}, ['-e', 'print $::x'],
"",
qq{Name "main::x" used only once: possible typo at -e line 1.\nUse of uninitialized value in print at -e line 1.\n});
-try($T++, {PERL5OPT => '-Mstrict'}, ['-e', 'print $::x'],
+try({PERL5OPT => '-Mstrict'}, ['-e', 'print $::x'],
"", "");
-try($T++, {PERL5OPT => '-Mstrict'}, ['-e', 'print $x'],
+try({PERL5OPT => '-Mstrict'}, ['-e', 'print $x'],
"",
qq{Global symbol "\$x" requires explicit package name at -e line 1.\nExecution of -e aborted due to compilation errors.\n});
# Fails in 5.6.0
-try($T++, {PERL5OPT => '-Mstrict -w'}, ['-e', 'print $x'],
+try({PERL5OPT => '-Mstrict -w'}, ['-e', 'print $x'],
"",
qq{Global symbol "\$x" requires explicit package name at -e line 1.\nExecution of -e aborted due to compilation errors.\n});
# Fails in 5.6.0
-try($T++, {PERL5OPT => '-w -Mstrict'}, ['-e', 'print $::x'],
+try({PERL5OPT => '-w -Mstrict'}, ['-e', 'print $::x'],
"",
<<ERROR
Name "main::x" used only once: possible typo at -e line 1.
);
# Fails in 5.6.0
-try($T++, {PERL5OPT => '-w -Mstrict'}, ['-e', 'print $::x'],
+try({PERL5OPT => '-w -Mstrict'}, ['-e', 'print $::x'],
"",
<<ERROR
Name "main::x" used only once: possible typo at -e line 1.
ERROR
);
-try($T++, {PERL5OPT => '-MExporter'}, ['-e0'],
+try({PERL5OPT => '-MExporter'}, ['-e0'],
"",
"");
# Fails in 5.6.0
-try($T++, {PERL5OPT => '-MExporter -MExporter'}, ['-e0'],
+try({PERL5OPT => '-MExporter -MExporter'}, ['-e0'],
"",
"");
-try($T++, {PERL5OPT => '-Mstrict -Mwarnings'},
+try({PERL5OPT => '-Mstrict -Mwarnings'},
['-e', 'print "ok" if $INC{"strict.pm"} and $INC{"warnings.pm"}'],
"ok",
"");
-print "# ", $T-1, " tests total.\n";
+try({PERL5OPT => '-w -w'},
+ ['-e', 'print $ENV{PERL5OPT}'],
+ '-w -w',
+ '');
END {
1 while unlink $STDOUT;