3 # regression tests for old bugs that don't fit other categories
6 require Config; import Config;
8 if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
9 print "1..0 # Skip: Data::Dumper was not built\n";
15 use Test::More tests => 7;
22 $count++ while each %$h;
26 my $dumper = Data::Dumper->new( [\%ENV], ['ENV'] )->Sortkeys(1);
27 my $orig_count = iterate_hash(\%ENV);
29 my $new_count = iterate_hash(\%ENV);
30 is($new_count, $orig_count, 'correctly resets hash iterators');
33 # [perl #38612] Data::Dumper core dump in 5.8.6, fixed by 5.8.7
36 local $Data::Dumper::Terse = 1;
37 my $c = eval Dumper($s);
40 my $d = Data::Dumper->new([$c]);
45 ok(1, "[perl #38612]"); # Still no core dump? We are fine.
51 my $d = Data::Dumper->new([\%h]);
56 is_deeply($VAR1, \%h, '[perl #40668] Reset hash iterator');
59 # [perl #64744] Data::Dumper each() bad interaction
61 local $Data::Dumper::Useqq = 1;
62 my $a = {foo => 1, bar => 1};
66 my $d = Data::Dumper->new([$a]);
71 is_deeply($VAR1, $a, '[perl #64744] Reset hash iterator');
74 # [perl #56766] Segfaults on bad syntax - fixed with version 2.121_17
77 # 2nd arg is supposed to be an arrayref
78 my $doh = Data::Dumper->Dump([\@_],'@_');
81 ok(1, "[perl #56766]"); # Still no core dump? We are fine.
84 skip "perl 5.10.1 crashes and DD cannot help it", 1 if $] < 5.0119999;
85 # [perl #72332] Segfault on empty-string glob
86 Data::Dumper->Dump([*{*STDERR{IO}}]);
88 "empty-string glob [perl #72332]");
91 # writing out of bounds with malformed utf8
93 eval { require Encode };
94 skip("Encode not available", 1) if $@;
96 local $SIG{__WARN__} = sub {};
100 ok("ok", "no crash dumping malformed utf8 with the utf8 flag on");