diff --git a/Changes b/Changes index 6af0ef47..1afdf4de 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,9 @@ Revision history for WWW::Mechanize {{$NEXT}} + [FIXED] + - There was a test suite failure on some Windows machines introduced in + 2.14 that is now fixed. (GH#350) (Julien Fiegehenn) [ENHANCEMENTS] - form_with and all_forms_with() now support the "action" attribute to find forms (GH#349) (Julien Fiegehenn) diff --git a/t/mech-dump/file_not_found.t b/t/mech-dump/file_not_found.t new file mode 100644 index 00000000..262d01e9 --- /dev/null +++ b/t/mech-dump/file_not_found.t @@ -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; diff --git a/t/mech-dump/mech-dump.t b/t/mech-dump/mech-dump.t index bd319a83..c85308fb 100644 --- a/t/mech-dump/mech-dump.t +++ b/t/mech-dump/mech-dump.t @@ -4,7 +4,6 @@ use warnings; use strict; use Test::More; -use Test::Output qw( output_like ); use File::Spec (); use LWP (); @@ -149,25 +148,4 @@ EOF is_deeply( \@actual, \@expected, 'Rest of the lines match' ); }; -subtest 'Local file not found' => sub { - SKIP: { - # See https://stackoverflow.com/a/32054866/1331451 - skip 'capturing output from system() is broken in 5.14 and 5.16 on Windows', 1 - if $^O eq 'MSWin32' && ( $] >= 5.014 && $] < 5.017 ); - - # 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; \ No newline at end of file