-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
run test that captures STDERR without taint mode #350
It seems that on certain Windows versions File::Temp is not working properly when run under taint mode. This problem must have been around for a while. Test::Output uses File::Temp, and therefore runs into this problem as our mech-dump.t has had the -T flag enabled. I do not know why we run under taint for some tests, but I have decided the most pragmatic fix is to undo my previous changes from #292 to the test an to move this particular test into its own file, which can run without taint. Also see https://www.perlmonks.org/?node_id=1122816 for details on the original problem.
- Loading branch information
Showing
3 changed files
with
43 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!perl | ||
|
||
use warnings; | ||
use strict; | ||
|
||
use Test::More; | ||
use Test::Output qw(output_like); | ||
use File::Spec (); | ||
|
||
# See https://stackoverflow.com/a/32054866/1331451 | ||
plan skip_all => | ||
'capturing output from system() is broken in 5.14 and 5.16 on Windows' | ||
if $^O eq 'MSWin32' && ( $] >= 5.014 && $] < 5.017 ); | ||
|
||
plan skip_all => 'Not installing mech-dump' | ||
if -e File::Spec->catfile(qw( t SKIP-MECH-DUMP )); | ||
|
||
my $exe = File::Spec->catfile(qw( script mech-dump )); | ||
if ( $^O eq 'VMS' ) { | ||
$exe = qq[mcr $^X -Ilib $exe]; | ||
} | ||
|
||
my $perl; | ||
$perl = $1 if $^X =~ /^(.+)$/; | ||
|
||
# The following file should not exist. | ||
my $source = 'file:not_found.404'; | ||
|
||
my $command = "$perl -Ilib $exe $source"; | ||
|
||
output_like( | ||
sub { | ||
system $command; | ||
}, | ||
undef, | ||
qr/file:not_found.404 returns status 404/, | ||
'Errors when a local file is not found' | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters