diff options
Diffstat (limited to 'dist/Data-Dumper/t/deparse.t')
-rw-r--r-- | dist/Data-Dumper/t/deparse.t | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/dist/Data-Dumper/t/deparse.t b/dist/Data-Dumper/t/deparse.t index c281fcea02..cddde8cb6e 100644 --- a/dist/Data-Dumper/t/deparse.t +++ b/dist/Data-Dumper/t/deparse.t @@ -15,7 +15,7 @@ BEGIN { use strict; use Data::Dumper; -use Test::More tests => 8; +use Test::More tests => 16; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -24,7 +24,9 @@ use Testing qw( _dumptostr ); note("\$Data::Dumper::Deparse and Deparse()"); -{ +for my $useperl (0, 1) { + local $Data::Dumper::Useperl = $useperl; + my ($obj, %dumps, $deparse, $starting); use strict; my $struct = { foo => "bar\nbaz", quux => sub { "fleem" } }; @@ -46,11 +48,11 @@ note("\$Data::Dumper::Deparse and Deparse()"); $dumps{'objzero'} = _dumptostr($obj); is($dumps{'noprev'}, $dumps{'dddzero'}, - "No previous setting and \$Data::Dumper::Deparse = 0 are equivalent"); + "No previous setting and \$Data::Dumper::Deparse = 0 are equivalent (useperl=$useperl)"); is($dumps{'noprev'}, $dumps{'objempty'}, - "No previous setting and Deparse() are equivalent"); + "No previous setting and Deparse() are equivalent (useperl=$useperl)"); is($dumps{'noprev'}, $dumps{'objzero'}, - "No previous setting and Deparse(0) are equivalent"); + "No previous setting and Deparse(0) are equivalent (useperl=$useperl)"); local $Data::Dumper::Deparse = 1; $obj = Data::Dumper->new( [ $struct ] ); @@ -62,19 +64,19 @@ note("\$Data::Dumper::Deparse and Deparse()"); $dumps{'objone'} = _dumptostr($obj); is($dumps{'dddtrue'}, $dumps{'objone'}, - "\$Data::Dumper::Deparse = 1 and Deparse(1) are equivalent"); + "\$Data::Dumper::Deparse = 1 and Deparse(1) are equivalent (useperl=$useperl)"); isnt($dumps{'dddzero'}, $dumps{'dddtrue'}, - "\$Data::Dumper::Deparse = 0 differs from \$Data::Dumper::Deparse = 1"); + "\$Data::Dumper::Deparse = 0 differs from \$Data::Dumper::Deparse = 1 (useperl=$useperl)"); like($dumps{'dddzero'}, qr/quux.*?sub.*?DUMMY/s, - "\$Data::Dumper::Deparse = 0 reports DUMMY instead of deparsing coderef"); + "\$Data::Dumper::Deparse = 0 reports DUMMY instead of deparsing coderef (useperl=$useperl)"); unlike($dumps{'dddtrue'}, qr/quux.*?sub.*?DUMMY/s, - "\$Data::Dumper::Deparse = 1 does not report DUMMY"); + "\$Data::Dumper::Deparse = 1 does not report DUMMY (useperl=$useperl)"); like($dumps{'dddtrue'}, qr/quux.*?sub.*?use\sstrict.*?fleem/s, - "\$Data::Dumper::Deparse = 1 deparses coderef"); + "\$Data::Dumper::Deparse = 1 deparses coderef (useperl=$useperl)"); } |