From: Rafael Garcia-Suarez Date: Fri, 2 Sep 2005 12:53:49 +0000 (+0000) Subject: Regression test for the fix in change #25308, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd85fe9f7f1f07fbb5e40b599391665cc850bd43;p=p5sagit%2Fp5-mst-13.2.git Regression test for the fix in change #25308, based on code by Troy Loveday p4raw-link: @25308 on //depot/perl: 27688d77084069fcb656e12fab5d3ee0ba810e6c p4raw-id: //depot/perl@25347 --- diff --git a/MANIFEST b/MANIFEST index 5254b7f..1b8901f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -196,6 +196,7 @@ ext/Data/Dumper/Changes Data pretty printer, changelog ext/Data/Dumper/Dumper.pm Data pretty printer, module ext/Data/Dumper/Dumper.xs Data pretty printer, externals ext/Data/Dumper/Makefile.PL Data pretty printer, makefile writer +ext/Data/Dumper/t/bugs.t See if Data::Dumper works ext/Data/Dumper/t/dumper.t See if Data::Dumper works ext/Data/Dumper/t/freezer.t See if $Data::Dumper::Freezer works ext/Data/Dumper/Todo Data pretty printer, futures diff --git a/ext/Data/Dumper/t/bugs.t b/ext/Data/Dumper/t/bugs.t new file mode 100644 index 0000000..faa78de --- /dev/null +++ b/ext/Data/Dumper/t/bugs.t @@ -0,0 +1,35 @@ +#!perl +# +# regression tests for old bugs that don't fit other categories + +BEGIN { + if ($ENV{PERL_CORE}){ + chdir 't' if -d 't'; + unshift @INC, '../lib'; + require Config; import Config; + no warnings 'once'; + if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { + print "1..0 # Skip: Data::Dumper was not built\n"; + exit 0; + } + } +} + +use strict; +use Test::More tests => 1; +use Data::Dumper; + +{ + sub iterate_hash { + my ($h) = @_; + my $count = 0; + $count++ while each %$h; + return $count; + } + + my $dumper = Data::Dumper->new( [\%ENV], ['ENV'] )->Sortkeys(1); + my $orig_count = iterate_hash(\%ENV); + $dumper->Dump; + my $new_count = iterate_hash(\%ENV); + is($new_count, $orig_count, 'correctly resets hash iterators'); +}