diff options
Diffstat (limited to 'dist')
-rw-r--r-- | dist/Data-Dumper/Dumper.pm | 42 | ||||
-rw-r--r-- | dist/Data-Dumper/t/indent.t | 8 | ||||
-rw-r--r-- | dist/Data-Dumper/t/misc.t | 16 | ||||
-rw-r--r-- | dist/Data-Dumper/t/purity_deepcopy_maxdepth.t | 17 | ||||
-rw-r--r-- | dist/Data-Dumper/t/quotekeys.t | 5 | ||||
-rw-r--r-- | dist/Data-Dumper/t/terse.t | 33 |
6 files changed, 36 insertions, 85 deletions
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index 441e97329e..41433fc533 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -10,7 +10,7 @@ package Data::Dumper; BEGIN { - $VERSION = '2.168'; # Don't forget to set version and release + $VERSION = '2.169'; # Don't forget to set version and release } # date in POD below! #$| = 1; @@ -627,7 +627,7 @@ sub Reset { sub Indent { my($s, $v) = @_; - if (defined($v)) { + if (@_ >= 2) { if ($v == 0) { $s->{xpad} = ""; $s->{sep} = ""; @@ -646,92 +646,92 @@ sub Indent { sub Trailingcomma { my($s, $v) = @_; - defined($v) ? (($s->{trailingcomma} = $v), return $s) : $s->{trailingcomma}; + @_ >= 2 ? (($s->{trailingcomma} = $v), return $s) : $s->{trailingcomma}; } sub Pair { my($s, $v) = @_; - defined($v) ? (($s->{pair} = $v), return $s) : $s->{pair}; + @_ >= 2 ? (($s->{pair} = $v), return $s) : $s->{pair}; } sub Pad { my($s, $v) = @_; - defined($v) ? (($s->{pad} = $v), return $s) : $s->{pad}; + @_ >= 2 ? (($s->{pad} = $v), return $s) : $s->{pad}; } sub Varname { my($s, $v) = @_; - defined($v) ? (($s->{varname} = $v), return $s) : $s->{varname}; + @_ >= 2 ? (($s->{varname} = $v), return $s) : $s->{varname}; } sub Purity { my($s, $v) = @_; - defined($v) ? (($s->{purity} = $v), return $s) : $s->{purity}; + @_ >= 2 ? (($s->{purity} = $v), return $s) : $s->{purity}; } sub Useqq { my($s, $v) = @_; - defined($v) ? (($s->{useqq} = $v), return $s) : $s->{useqq}; + @_ >= 2 ? (($s->{useqq} = $v), return $s) : $s->{useqq}; } sub Terse { my($s, $v) = @_; - defined($v) ? (($s->{terse} = $v), return $s) : $s->{terse}; + @_ >= 2 ? (($s->{terse} = $v), return $s) : $s->{terse}; } sub Freezer { my($s, $v) = @_; - defined($v) ? (($s->{freezer} = $v), return $s) : $s->{freezer}; + @_ >= 2 ? (($s->{freezer} = $v), return $s) : $s->{freezer}; } sub Toaster { my($s, $v) = @_; - defined($v) ? (($s->{toaster} = $v), return $s) : $s->{toaster}; + @_ >= 2 ? (($s->{toaster} = $v), return $s) : $s->{toaster}; } sub Deepcopy { my($s, $v) = @_; - defined($v) ? (($s->{deepcopy} = $v), return $s) : $s->{deepcopy}; + @_ >= 2 ? (($s->{deepcopy} = $v), return $s) : $s->{deepcopy}; } sub Quotekeys { my($s, $v) = @_; - defined($v) ? (($s->{quotekeys} = $v), return $s) : $s->{quotekeys}; + @_ >= 2 ? (($s->{quotekeys} = $v), return $s) : $s->{quotekeys}; } sub Bless { my($s, $v) = @_; - defined($v) ? (($s->{'bless'} = $v), return $s) : $s->{'bless'}; + @_ >= 2 ? (($s->{'bless'} = $v), return $s) : $s->{'bless'}; } sub Maxdepth { my($s, $v) = @_; - defined($v) ? (($s->{'maxdepth'} = $v), return $s) : $s->{'maxdepth'}; + @_ >= 2 ? (($s->{'maxdepth'} = $v), return $s) : $s->{'maxdepth'}; } sub Maxrecurse { my($s, $v) = @_; - defined($v) ? (($s->{'maxrecurse'} = $v), return $s) : $s->{'maxrecurse'}; + @_ >= 2 ? (($s->{'maxrecurse'} = $v), return $s) : $s->{'maxrecurse'}; } sub Useperl { my($s, $v) = @_; - defined($v) ? (($s->{'useperl'} = $v), return $s) : $s->{'useperl'}; + @_ >= 2 ? (($s->{'useperl'} = $v), return $s) : $s->{'useperl'}; } sub Sortkeys { my($s, $v) = @_; - defined($v) ? (($s->{'sortkeys'} = $v), return $s) : $s->{'sortkeys'}; + @_ >= 2 ? (($s->{'sortkeys'} = $v), return $s) : $s->{'sortkeys'}; } sub Deparse { my($s, $v) = @_; - defined($v) ? (($s->{'deparse'} = $v), return $s) : $s->{'deparse'}; + @_ >= 2 ? (($s->{'deparse'} = $v), return $s) : $s->{'deparse'}; } sub Sparseseen { my($s, $v) = @_; - defined($v) ? (($s->{'noseen'} = $v), return $s) : $s->{'noseen'}; + @_ >= 2 ? (($s->{'noseen'} = $v), return $s) : $s->{'noseen'}; } # used by qquote below @@ -1474,7 +1474,7 @@ modify it under the same terms as Perl itself. =head1 VERSION -Version 2.168 +Version 2.169 =head1 SEE ALSO diff --git a/dist/Data-Dumper/t/indent.t b/dist/Data-Dumper/t/indent.t index bcfa251f71..2814f0b215 100644 --- a/dist/Data-Dumper/t/indent.t +++ b/dist/Data-Dumper/t/indent.t @@ -14,7 +14,7 @@ BEGIN { use strict; use Data::Dumper; -use Test::More tests => 10; +use Test::More tests => 9; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -35,10 +35,6 @@ $dumper->Indent(); $dumpstr{indent_no_arg} = _dumptostr($dumper); $dumper = Data::Dumper->new([$hash]); -$dumper->Indent(undef); -$dumpstr{indent_undef} = _dumptostr($dumper); - -$dumper = Data::Dumper->new([$hash]); $dumper->Indent(0); $dumpstr{indent_0} = _dumptostr($dumper); # $VAR1 = {'foo' => 42}; # no newline @@ -59,8 +55,6 @@ $dumpstr{indent_2} = _dumptostr($dumper); is($dumpstr{noindent}, $dumpstr{indent_no_arg}, "absence of Indent is same as Indent()"); -is($dumpstr{noindent}, $dumpstr{indent_undef}, - "absence of Indent is same as Indent(undef)"); isnt($dumpstr{noindent}, $dumpstr{indent_0}, "absence of Indent is different from Indent(0)"); isnt($dumpstr{indent_0}, $dumpstr{indent_1}, diff --git a/dist/Data-Dumper/t/misc.t b/dist/Data-Dumper/t/misc.t index 2ce81acc02..54a89e6dbc 100644 --- a/dist/Data-Dumper/t/misc.t +++ b/dist/Data-Dumper/t/misc.t @@ -15,7 +15,7 @@ BEGIN { use strict; use Data::Dumper; -use Test::More tests => 20; +use Test::More tests => 18; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -77,16 +77,9 @@ note("Argument validation for new()"); $dumps{'noprev'} = _dumptostr($obj); $obj = Data::Dumper->new([$a,$b]); - $obj->Pad(undef); - $dumps{'undef'} = _dumptostr($obj); - - $obj = Data::Dumper->new([$a,$b]); $obj->Pad(''); $dumps{'emptystring'} = _dumptostr($obj); - is($dumps{'noprev'}, $dumps{'undef'}, - "No setting for \$Data::Dumper::Pad and Pad(undef) give same result"); - is($dumps{'noprev'}, $dumps{'emptystring'}, "No setting for \$Data::Dumper::Pad and Pad('') give same result"); @@ -114,16 +107,9 @@ note("Argument validation for new()"); $dumps{'noprev'} = _dumptostr($obj); $obj = Data::Dumper->new([$a,$b]); - $obj->Varname(undef); - $dumps{'undef'} = _dumptostr($obj); - - $obj = Data::Dumper->new([$a,$b]); $obj->Varname(''); $dumps{'emptystring'} = _dumptostr($obj); - is($dumps{'noprev'}, $dumps{'undef'}, - "No setting for \$Data::Dumper::Varname and Varname(undef) give same result"); - # Because Varname defaults to '$VAR', providing an empty argument to # Varname produces a non-default result. isnt($dumps{'noprev'}, $dumps{'emptystring'}, diff --git a/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t b/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t index f287101ae3..3a7dc49b19 100644 --- a/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t +++ b/dist/Data-Dumper/t/purity_deepcopy_maxdepth.t @@ -16,7 +16,7 @@ BEGIN { use strict; use Data::Dumper; -use Test::More tests => 24; +use Test::More tests => 22; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -80,14 +80,6 @@ note("\$Data::Dumper::Purity and Purity()"); is($dumps{'noprev'}, $dumps{'objzero'}, "No previous Purity setting equivalent to Purity(0)"); - - $purity = undef; - $obj = Data::Dumper->new([$a,$b,$c], [qw(a b c)]); - $obj->Purity($purity); - $dumps{'objundef'} = _dumptostr($obj); - - is($dumps{'noprev'}, $dumps{'objundef'}, - "No previous Purity setting equivalent to Purity(undef)"); } { @@ -364,13 +356,6 @@ note("\$Data::Dumper::Maxdepth and Maxdepth()"); is($dumps{'noprev'}, $dumps{'maxdepthempty'}, "No previous Maxdepth setting equivalent to Maxdepth() with no argument"); - $obj = Data::Dumper->new([$f], [qw(f)]); - $obj->Maxdepth(undef); - $dumps{'maxdepthundef'} = _dumptostr($obj); - - is($dumps{'noprev'}, $dumps{'maxdepthundef'}, - "No previous Maxdepth setting equivalent to Maxdepth(undef)"); - $maxdepth = 3; $obj = Data::Dumper->new([$f], [qw(f)]); $obj->Maxdepth($maxdepth); diff --git a/dist/Data-Dumper/t/quotekeys.t b/dist/Data-Dumper/t/quotekeys.t index 0f6313a264..076cdf6f8a 100644 --- a/dist/Data-Dumper/t/quotekeys.t +++ b/dist/Data-Dumper/t/quotekeys.t @@ -86,10 +86,9 @@ sub run_tests_for_quotekeys { $obj->Quotekeys($quotekeys); $dumps{'objqkundef'} = _dumptostr($obj); - note("Quotekeys(undef) will fall back to the default value\nfor \$Data::Dumper::Quotekeys, which is a true value."); - isnt($dumps{'ddqkundef'}, $dumps{'objqkundef'}, + is($dumps{'ddqkundef'}, $dumps{'objqkundef'}, "\$Data::Dumper::Quotekeys = undef and Quotekeys(undef) are equivalent"); - isnt($dumps{'ddqkzero'}, $dumps{'objqkundef'}, + is($dumps{'ddqkzero'}, $dumps{'objqkundef'}, "\$Data::Dumper::Quotekeys = undef and = 0 are equivalent"); %dumps = (); diff --git a/dist/Data-Dumper/t/terse.t b/dist/Data-Dumper/t/terse.t index a5be98050c..a815c365d5 100644 --- a/dist/Data-Dumper/t/terse.t +++ b/dist/Data-Dumper/t/terse.t @@ -3,7 +3,7 @@ use strict; use warnings; use Data::Dumper; -use Test::More tests => 6; +use Test::More tests => 10; use lib qw( ./t/lib ); use Testing qw( _dumptostr ); @@ -23,39 +23,26 @@ for my $useperl (0..1) { WANT } -my (%dumpstr); my $dumper; $dumper = Data::Dumper->new([$hash]); -$dumpstr{noterse} = _dumptostr($dumper); -# $VAR1 = { -# 'foo' => 42 -# }; +my $dumpstr_noterse = _dumptostr($dumper); $dumper = Data::Dumper->new([$hash]); $dumper->Terse(); -$dumpstr{terse_no_arg} = _dumptostr($dumper); +is _dumptostr($dumper), $dumpstr_noterse; $dumper = Data::Dumper->new([$hash]); $dumper->Terse(0); -$dumpstr{terse_0} = _dumptostr($dumper); +is _dumptostr($dumper), $dumpstr_noterse; $dumper = Data::Dumper->new([$hash]); $dumper->Terse(1); -$dumpstr{terse_1} = _dumptostr($dumper); -# { -# 'foo' => 42 -# } +isnt _dumptostr($dumper), $dumpstr_noterse; $dumper = Data::Dumper->new([$hash]); -$dumper->Terse(undef); -$dumpstr{terse_undef} = _dumptostr($dumper); - -is($dumpstr{noterse}, $dumpstr{terse_no_arg}, - "absence of Terse is same as Terse()"); -is($dumpstr{noterse}, $dumpstr{terse_0}, - "absence of Terse is same as Terse(0)"); -isnt($dumpstr{noterse}, $dumpstr{terse_1}, - "absence of Terse is different from Terse(1)"); -is($dumpstr{noterse}, $dumpstr{terse_undef}, - "absence of Terse is same as Terse(undef)"); +is $dumper->Terse(1), $dumper; +is $dumper->Terse, 1; +is $dumper->Terse(undef), $dumper; +is $dumper->Terse, undef; +is _dumptostr($dumper), $dumpstr_noterse; |