Commit | Line | Data |
---|---|---|
361d9b55 Z |
1 | use warnings; |
2 | use strict; | |
3 | ||
4 | use Test::More tests => 28; | |
5 | ||
6 | BEGIN { $^H |= 0x20000; } | |
7 | ||
8 | my $t; | |
9 | ||
10 | $t = ""; | |
11 | eval q{ | |
12 | use XS::APItest qw(swaplabel); | |
13 | $t .= "a"; | |
14 | $t .= "b"; | |
15 | swaplabel $t .= "c"; | |
16 | swaplabel $t .= "d"; | |
17 | $t .= "e"; | |
18 | }; | |
19 | is $@, ""; | |
20 | is $t, "abcde"; | |
21 | ||
22 | $t = ""; | |
23 | eval q{ | |
24 | use XS::APItest qw(swaplabel); | |
25 | $t .= "a"; | |
26 | Lb: $t .= "b"; | |
27 | swaplabel $t .= "c"; Lc: | |
28 | swaplabel $t .= "d"; Ld: | |
29 | Le: $t .= "e"; | |
30 | }; | |
31 | is $@, ""; | |
32 | is $t, "abcde"; | |
33 | ||
34 | $t = ""; | |
35 | eval q{ | |
36 | use XS::APItest qw(swaplabel); | |
37 | $t .= "a"; | |
38 | goto Lb; | |
39 | Lb: $t .= "b"; | |
40 | swaplabel $t .= "c"; Lc: | |
41 | swaplabel $t .= "d"; Ld: | |
42 | Le: $t .= "e"; | |
43 | }; | |
44 | is $@, ""; | |
45 | is $t, "abcde"; | |
46 | ||
47 | $t = ""; | |
48 | eval q{ | |
49 | use XS::APItest qw(swaplabel); | |
50 | $t .= "a"; | |
51 | goto Lc; | |
52 | Lb: $t .= "b"; | |
53 | swaplabel $t .= "c"; Lc: | |
54 | swaplabel $t .= "d"; Ld: | |
55 | Le: $t .= "e"; | |
56 | }; | |
57 | is $@, ""; | |
58 | is $t, "acde"; | |
59 | ||
60 | $t = ""; | |
61 | eval q{ | |
62 | use XS::APItest qw(swaplabel); | |
63 | $t .= "a"; | |
64 | goto Ld; | |
65 | Lb: $t .= "b"; | |
66 | swaplabel $t .= "c"; Lc: | |
67 | swaplabel $t .= "d"; Ld: | |
68 | Le: $t .= "e"; | |
69 | }; | |
70 | is $@, ""; | |
71 | is $t, "ade"; | |
72 | ||
73 | $t = ""; | |
74 | eval q{ | |
75 | use XS::APItest qw(swaplabel); | |
76 | $t .= "a"; | |
77 | goto Le; | |
78 | Lb: $t .= "b"; | |
79 | swaplabel $t .= "c"; Lc: | |
80 | swaplabel $t .= "d"; Ld: | |
81 | Le: $t .= "e"; | |
82 | }; | |
83 | is $@, ""; | |
84 | is $t, "ae"; | |
85 | ||
86 | $t = ""; | |
87 | eval q{ | |
88 | use XS::APItest qw(swaplabel); | |
89 | $t .= "a"; | |
90 | swaplabel $t .= "b"; y: | |
91 | $t .= "c"; | |
92 | }; | |
93 | isnt $@, ""; | |
94 | is $t, ""; | |
95 | ||
96 | $t = ""; | |
97 | eval q{ | |
98 | use XS::APItest qw(swaplabel); | |
99 | if(1) { $t .= "a"; } | |
100 | if(1) { $t .= "b"; } | |
101 | swaplabel if(1) { $t .= "c"; } | |
102 | swaplabel if(1) { $t .= "d"; } | |
103 | if(1) { $t .= "e"; } | |
104 | }; | |
105 | is $@, ""; | |
106 | is $t, "abcde"; | |
107 | ||
108 | $t = ""; | |
109 | eval q{ | |
110 | use XS::APItest qw(swaplabel); | |
111 | if(1) { $t .= "a"; } | |
112 | Lb: if(1) { $t .= "b"; } | |
113 | swaplabel if(1) { $t .= "c"; } Lc: | |
114 | swaplabel if(1) { $t .= "d"; } Ld: | |
115 | Le: if(1) { $t .= "e"; } | |
116 | }; | |
117 | is $@, ""; | |
118 | is $t, "abcde"; | |
119 | ||
120 | $t = ""; | |
121 | eval q{ | |
122 | use XS::APItest qw(swaplabel); | |
123 | if(1) { $t .= "a"; } | |
124 | goto Lb; | |
125 | Lb: if(1) { $t .= "b"; } | |
126 | swaplabel if(1) { $t .= "c"; } Lc: | |
127 | swaplabel if(1) { $t .= "d"; } Ld: | |
128 | Le: if(1) { $t .= "e"; } | |
129 | }; | |
130 | is $@, ""; | |
131 | is $t, "abcde"; | |
132 | ||
133 | $t = ""; | |
134 | eval q{ | |
135 | use XS::APItest qw(swaplabel); | |
136 | if(1) { $t .= "a"; } | |
137 | goto Lc; | |
138 | Lb: if(1) { $t .= "b"; } | |
139 | swaplabel if(1) { $t .= "c"; } Lc: | |
140 | swaplabel if(1) { $t .= "d"; } Ld: | |
141 | Le: if(1) { $t .= "e"; } | |
142 | }; | |
143 | is $@, ""; | |
144 | is $t, "acde"; | |
145 | ||
146 | $t = ""; | |
147 | eval q{ | |
148 | use XS::APItest qw(swaplabel); | |
149 | if(1) { $t .= "a"; } | |
150 | goto Ld; | |
151 | Lb: if(1) { $t .= "b"; } | |
152 | swaplabel if(1) { $t .= "c"; } Lc: | |
153 | swaplabel if(1) { $t .= "d"; } Ld: | |
154 | Le: if(1) { $t .= "e"; } | |
155 | }; | |
156 | is $@, ""; | |
157 | is $t, "ade"; | |
158 | ||
159 | $t = ""; | |
160 | eval q{ | |
161 | use XS::APItest qw(swaplabel); | |
162 | if(1) { $t .= "a"; } | |
163 | goto Le; | |
164 | Lb: if(1) { $t .= "b"; } | |
165 | swaplabel if(1) { $t .= "c"; } Lc: | |
166 | swaplabel if(1) { $t .= "d"; } Ld: | |
167 | Le: if(1) { $t .= "e"; } | |
168 | }; | |
169 | is $@, ""; | |
170 | is $t, "ae"; | |
171 | ||
172 | $t = ""; | |
173 | eval q{ | |
174 | use XS::APItest qw(swaplabel); | |
175 | if(1) { $t .= "a"; } | |
176 | swaplabel if(1) { $t .= "b"; } y: | |
177 | if(1) { $t .= "c"; } | |
178 | }; | |
179 | isnt $@, ""; | |
180 | is $t, ""; | |
181 | ||
182 | 1; |