source: trunk/essentials/dev-lang/perl/ext/Data/Dumper/t/bugs.t

Last change on this file was 3181, checked in by bird, 19 years ago

perl 5.8.8

File size: 745 bytes
Line 
1#!perl
2#
3# regression tests for old bugs that don't fit other categories
4
5BEGIN {
6 if ($ENV{PERL_CORE}){
7 chdir 't' if -d 't';
8 unshift @INC, '../lib';
9 require Config; import Config;
10 no warnings 'once';
11 if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
12 print "1..0 # Skip: Data::Dumper was not built\n";
13 exit 0;
14 }
15 }
16}
17
18use strict;
19use Test::More tests => 1;
20use Data::Dumper;
21
22{
23 sub iterate_hash {
24 my ($h) = @_;
25 my $count = 0;
26 $count++ while each %$h;
27 return $count;
28 }
29
30 my $dumper = Data::Dumper->new( [\%ENV], ['ENV'] )->Sortkeys(1);
31 my $orig_count = iterate_hash(\%ENV);
32 $dumper->Dump;
33 my $new_count = iterate_hash(\%ENV);
34 is($new_count, $orig_count, 'correctly resets hash iterators');
35}
Note: See TracBrowser for help on using the repository browser.