Skip to content

Commit c135673

Browse files
committed
Data-Dumper: fix deparse.t for non-XS testing
This is a follow-up to b5048e7, which added 'Deparse' support to XS and made both XS and pure Perl testing mandatory. The other test files treat XS as optional, so this patch follows that pattern. (If we decide that the XS part of Data::Dumper is not optional, we should change all the other test files for consistency.) Previously, testing without XS available resulted in: t/deparse.t ................... Undefined subroutine &Data::Dumper::Dumpxs called at .../dist/Data-Dumper/blib/lib/Data/Dumper.pm line 213. # Looks like your test exited with 255 before it could output anything. t/deparse.t ................... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 16/16 subtests ... t/deparse.t (Wstat: 65280 (exited 255) Tests: 0 Failed: 0) Non-zero exit status: 255 Parse errors: Bad plan. You planned 16 tests but ran 0.
1 parent f8cc94d commit c135673

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dist/Data-Dumper/t/deparse.t

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use strict;
55
use warnings;
66

77
use Data::Dumper;
8-
use Test::More tests => 16;
8+
use Test::More tests => 16;
99
use lib qw( ./t/lib );
1010
use Testing qw( _dumptostr );
1111

@@ -14,11 +14,18 @@ use Testing qw( _dumptostr );
1414

1515
note("\$Data::Dumper::Deparse and Deparse()");
1616

17-
for my $useperl (0, 1) {
18-
local $Data::Dumper::Useperl = $useperl;
17+
run_tests_for_deparse();
18+
SKIP: {
19+
skip "XS version was unavailable, so we already ran with pure Perl", 8
20+
if $Data::Dumper::Useperl;
21+
local $Data::Dumper::Useperl = 1;
22+
run_tests_for_deparse();
23+
}
24+
25+
sub run_tests_for_deparse {
26+
my $useperl = $Data::Dumper::Useperl ? 1 : 0;
1927

2028
my ($obj, %dumps, $deparse, $starting);
21-
use strict;
2229
my $struct = { foo => "bar\nbaz", quux => sub { "fleem" } };
2330
$obj = Data::Dumper->new( [ $struct ] );
2431
$dumps{'noprev'} = _dumptostr($obj);

0 commit comments

Comments
 (0)