Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Data::Dumper pure-perl tests #22896

Merged
merged 5 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dist/Data-Dumper/t/bugs.t
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ SKIP: {

# writing out of bounds with malformed utf8
SKIP: {
skip("No XS available", 1) if !defined &Data::Dumper::Dumpxs;
eval { require Encode };
skip("Encode not available", 1) if $@;
local $^W=1;
Expand Down
15 changes: 11 additions & 4 deletions dist/Data-Dumper/t/deparse.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use strict;
use warnings;

use Data::Dumper;
use Test::More tests => 16;
use Test::More tests => 16;
use lib qw( ./t/lib );
use Testing qw( _dumptostr );

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

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

for my $useperl (0, 1) {
local $Data::Dumper::Useperl = $useperl;
run_tests_for_deparse();
SKIP: {
skip "XS version was unavailable, so we already ran with pure Perl", 8
if $Data::Dumper::Useperl;
local $Data::Dumper::Useperl = 1;
run_tests_for_deparse();
}

sub run_tests_for_deparse {
my $useperl = $Data::Dumper::Useperl ? 1 : 0;

my ($obj, %dumps, $deparse, $starting);
use strict;
my $struct = { foo => "bar\nbaz", quux => sub { "fleem" } };
$obj = Data::Dumper->new( [ $struct ] );
$dumps{'noprev'} = _dumptostr($obj);
Expand Down
20 changes: 2 additions & 18 deletions dist/Data-Dumper/t/dumpperl.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use warnings;

use Carp;
use Data::Dumper;
use Test::More tests => 31;
use Test::More tests => 11;
use lib qw( ./t/lib );
use Testing qw( _dumptostr );

Expand All @@ -20,23 +20,7 @@ $Data::Dumper::Indent=1;
run_tests_for_pure_perl_implementations();
}

{
local $Data::Dumper::Useperl=0;
local $Data::Dumper::Useqq=1;
local $Data::Dumper::Deparse=0;
note('$Data::Dumper::Useqq => 1');
run_tests_for_pure_perl_implementations();
}

{
local $Data::Dumper::Useperl=0;
local $Data::Dumper::Useqq=0;
local $Data::Dumper::Deparse=1;
note('$Data::Dumper::Deparse => 1');
run_tests_for_pure_perl_implementations();
}




sub run_tests_for_pure_perl_implementations {

Expand Down
2 changes: 1 addition & 1 deletion dist/Data-Dumper/t/quotekeys.t
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ my $is_ascii = ord("A") == 65;

run_tests_for_quotekeys();
SKIP: {
skip "XS version was unavailable, so we already ran with pure Perl", 5
skip "XS version was unavailable, so we already ran with pure Perl", 9
if $Data::Dumper::Useperl;
local $Data::Dumper::Useperl = 1;
run_tests_for_quotekeys();
Expand Down
2 changes: 1 addition & 1 deletion dist/Data-Dumper/t/sortkeys.t
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use Testing qw( _dumptostr );

run_tests_for_sortkeys();
SKIP: {
skip "XS version was unavailable, so we already ran with pure Perl", 13
skip "XS version was unavailable, so we already ran with pure Perl", 11
if $Data::Dumper::Useperl;
local $Data::Dumper::Useperl = 1;
run_tests_for_sortkeys();
Expand Down
Loading