This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #107372] DD and overloaded blessed globs
[perl5.git] / dist / Data-Dumper / t / perl-74170.t
1 #!perl -X
2 #
3 # Regression test for [perl #74170] (missing SPAGAIN after DD_Dump(...)):
4 # Since it’s so large, it gets its own file.
5
6 BEGIN {
7     require Config; import Config;
8     no warnings 'once';
9     if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
10         print "1..0 # Skip: Data::Dumper was not built\n";
11         exit 0;
12     }
13 }
14
15 use strict;
16 use Test::More tests => 1;
17 use Data::Dumper;
18
19 our %repos = ();
20 &real_life_setup();
21
22 $Data::Dumper::Indent = 1;
23 # A custom sort sub is necessary for reproducing the bug, as this is where
24 # the stack gets reallocated.
25 $Data::Dumper::Sortkeys = sub { return [ reverse sort keys %{$_[0]} ]; }
26     unless exists $ENV{NO_SORT_SUB};
27
28 ok +Data::Dumper->Dumpxs([\%repos], [qw(*repos)]);
29
30 sub real_life_setup {
31     # set up the %repos hash in a manner that reflects a real run of
32     # gitolite's "compiler" script:
33     # Yes, all this is necessary to get the stack in such a state that the
34     # custom sort sub will trigger a reallocation.
35     push @{ $repos{''}{'@all'} }, ();
36     push @{ $repos{''}{'guser86'} }, ();
37     push @{ $repos{''}{'guser87'} }, ();
38     push @{ $repos{''}{'user88'} }, ();
39     push @{ $repos{''}{'grussell'} }, ();
40     push @{ $repos{''}{'guser0'} }, ();
41     push @{ $repos{''}{'guser1'} }, ();
42     push @{ $repos{''}{'guser10'} }, ();
43     push @{ $repos{''}{'guser11'} }, ();
44     push @{ $repos{''}{'guser12'} }, ();
45     push @{ $repos{''}{'guser13'} }, ();
46     push @{ $repos{''}{'guser14'} }, ();
47     push @{ $repos{''}{'guser15'} }, ();
48     push @{ $repos{''}{'guser16'} }, ();
49     push @{ $repos{''}{'guser17'} }, ();
50     push @{ $repos{''}{'guser18'} }, ();
51     push @{ $repos{''}{'guser19'} }, ();
52     push @{ $repos{''}{'guser2'} }, ();
53     push @{ $repos{''}{'guser20'} }, ();
54     push @{ $repos{''}{'guser21'} }, ();
55     push @{ $repos{''}{'guser22'} }, ();
56     push @{ $repos{''}{'guser23'} }, ();
57     push @{ $repos{''}{'guser24'} }, ();
58     push @{ $repos{''}{'guser25'} }, ();
59     push @{ $repos{''}{'guser26'} }, ();
60     push @{ $repos{''}{'guser27'} }, ();
61     push @{ $repos{''}{'guser28'} }, ();
62     push @{ $repos{''}{'guser29'} }, ();
63     push @{ $repos{''}{'guser3'} }, ();
64     push @{ $repos{''}{'guser30'} }, ();
65     push @{ $repos{''}{'guser31'} }, ();
66     push @{ $repos{''}{'guser32'} }, ();
67     push @{ $repos{''}{'guser33'} }, ();
68     push @{ $repos{''}{'guser34'} }, ();
69     push @{ $repos{''}{'guser35'} }, ();
70     push @{ $repos{''}{'guser36'} }, ();
71     push @{ $repos{''}{'guser37'} }, ();
72     push @{ $repos{''}{'guser38'} }, ();
73     push @{ $repos{''}{'guser39'} }, ();
74     push @{ $repos{''}{'guser4'} }, ();
75     push @{ $repos{''}{'guser40'} }, ();
76     push @{ $repos{''}{'guser41'} }, ();
77     push @{ $repos{''}{'guser42'} }, ();
78     push @{ $repos{''}{'guser43'} }, ();
79     push @{ $repos{''}{'guser44'} }, ();
80     push @{ $repos{''}{'guser45'} }, ();
81     push @{ $repos{''}{'guser46'} }, ();
82     push @{ $repos{''}{'guser47'} }, ();
83     push @{ $repos{''}{'guser48'} }, ();
84     push @{ $repos{''}{'guser49'} }, ();
85     push @{ $repos{''}{'guser5'} }, ();
86     push @{ $repos{''}{'guser50'} }, ();
87     push @{ $repos{''}{'guser51'} }, ();
88     push @{ $repos{''}{'guser52'} }, ();
89     push @{ $repos{''}{'guser53'} }, ();
90     push @{ $repos{''}{'guser54'} }, ();
91     push @{ $repos{''}{'guser55'} }, ();
92     push @{ $repos{''}{'guser56'} }, ();
93     push @{ $repos{''}{'guser57'} }, ();
94     push @{ $repos{''}{'guser58'} }, ();
95     push @{ $repos{''}{'guser59'} }, ();
96     push @{ $repos{''}{'guser6'} }, ();
97     push @{ $repos{''}{'guser60'} }, ();
98     push @{ $repos{''}{'guser61'} }, ();
99     push @{ $repos{''}{'guser62'} }, ();
100     push @{ $repos{''}{'guser63'} }, ();
101     push @{ $repos{''}{'guser64'} }, ();
102     push @{ $repos{''}{'guser65'} }, ();
103     push @{ $repos{''}{'guser66'} }, ();
104     push @{ $repos{''}{'guser67'} }, ();
105     push @{ $repos{''}{'guser68'} }, ();
106     push @{ $repos{''}{'guser69'} }, ();
107     push @{ $repos{''}{'guser7'} }, ();
108     push @{ $repos{''}{'guser70'} }, ();
109     push @{ $repos{''}{'guser71'} }, ();
110     push @{ $repos{''}{'guser72'} }, ();
111     push @{ $repos{''}{'guser73'} }, ();
112     push @{ $repos{''}{'guser74'} }, ();
113     push @{ $repos{''}{'guser75'} }, ();
114     push @{ $repos{''}{'guser76'} }, ();
115     push @{ $repos{''}{'guser77'} }, ();
116     push @{ $repos{''}{'guser78'} }, ();
117     push @{ $repos{''}{'guser79'} }, ();
118     push @{ $repos{''}{'guser8'} }, ();
119     push @{ $repos{''}{'guser80'} }, ();
120     push @{ $repos{''}{'guser81'} }, ();
121     push @{ $repos{''}{'guser82'} }, ();
122     push @{ $repos{''}{'guser83'} }, ();
123     push @{ $repos{''}{'guser84'} }, ();
124     push @{ $repos{''}{'guser85'} }, ();
125     push @{ $repos{''}{'guser9'} }, ();
126     push @{ $repos{''}{'user1'} }, ();
127     push @{ $repos{''}{'user10'} }, ();
128     push @{ $repos{''}{'user11'} }, ();
129     push @{ $repos{''}{'user12'} }, ();
130     push @{ $repos{''}{'user13'} }, ();
131     push @{ $repos{''}{'user14'} }, ();
132     push @{ $repos{''}{'user15'} }, ();
133     push @{ $repos{''}{'user16'} }, ();
134     push @{ $repos{''}{'user2'} }, ();
135     push @{ $repos{''}{'user3'} }, ();
136     push @{ $repos{''}{'user4'} }, ();
137     push @{ $repos{''}{'user5'} }, ();
138     push @{ $repos{''}{'user6'} }, ();
139     push @{ $repos{''}{'user7'} }, ();
140     $repos{''}{R}{'user8'} = 1;
141     $repos{''}{W}{'user8'} = 1;
142     push @{ $repos{''}{'user8'} }, ();
143 }