1use warnings; 2use strict; 3 4use Test::More tests => 56; 5 6BEGIN { $^H |= 0x20000; } 7 8my $t; 9 10$t = ""; 11eval 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}; 19is $@, ""; 20is $t, "abcde"; 21 22$t = ""; 23eval 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}; 31is $@, ""; 32is $t, "abcde"; 33 34$t = ""; 35eval 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}; 44is $@, ""; 45is $t, "abcde"; 46 47$t = ""; 48eval 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}; 57is $@, ""; 58is $t, "acde"; 59 60$t = ""; 61eval 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}; 70is $@, ""; 71is $t, "ade"; 72 73$t = ""; 74eval 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}; 83is $@, ""; 84is $t, "ae"; 85 86$t = ""; 87eval q{ 88 use XS::APItest qw(swaplabel); 89 $t .= "a"; 90 swaplabel $t .= "b"; y: 91 $t .= "c"; 92}; 93isnt $@, ""; 94is $t, ""; 95 96$t = ""; 97eval 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}; 105is $@, ""; 106is $t, "abcde"; 107 108$t = ""; 109eval 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}; 117is $@, ""; 118is $t, "abcde"; 119 120$t = ""; 121eval 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}; 130is $@, ""; 131is $t, "abcde"; 132 133$t = ""; 134eval 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}; 143is $@, ""; 144is $t, "acde"; 145 146$t = ""; 147eval 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}; 156is $@, ""; 157is $t, "ade"; 158 159$t = ""; 160eval 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}; 169is $@, ""; 170is $t, "ae"; 171 172$t = ""; 173eval 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}; 179isnt $@, ""; 180is $t, ""; 181 182{ 183 use utf8; 184 use open qw( :utf8 :std ); 185 186 $t = ""; 187 eval q{ 188 use XS::APItest qw(swaplabel); 189 $t .= "ㅏ"; 190 $t .= "Ḇ"; 191 swaplabel $t .= "ᶜ"; 192 swaplabel $t .= "ᛑ"; 193 $t .= "ᶟ"; 194 }; 195 is $@, ""; 196 is $t, "ㅏḆᶜᛑᶟ"; 197 198 $t = ""; 199 eval q{ 200 use XS::APItest qw(swaplabel); 201 $t .= "ㅏ"; 202 LḆ: $t .= "Ḇ"; 203 swaplabel $t .= "ᶜ"; Lᶜ: 204 swaplabel $t .= "ᛑ"; Lᛑ: 205 Lᶟ: $t .= "ᶟ"; 206 }; 207 is $@, ""; 208 is $t, "ㅏḆᶜᛑᶟ"; 209 210 $t = ""; 211 eval q{ 212 use XS::APItest qw(swaplabel); 213 $t .= "ㅏ"; 214 goto LḆ; 215 LḆ: $t .= "Ḇ"; 216 swaplabel $t .= "ᶜ"; Lᶜ: 217 swaplabel $t .= "ᛑ"; Lᛑ: 218 Lᶟ: $t .= "ᶟ"; 219 }; 220 is $@, ""; 221 is $t, "ㅏḆᶜᛑᶟ"; 222 223 $t = ""; 224 eval q{ 225 use XS::APItest qw(swaplabel); 226 $t .= "ㅏ"; 227 goto Lᶜ; 228 LḆ: $t .= "Ḇ"; 229 swaplabel $t .= "ᶜ"; Lᶜ: 230 swaplabel $t .= "ᛑ"; Lᛑ: 231 Lᶟ: $t .= "ᶟ"; 232 }; 233 is $@, ""; 234 is $t, "ㅏᶜᛑᶟ"; 235 236 $t = ""; 237 eval q{ 238 use XS::APItest qw(swaplabel); 239 $t .= "ㅏ"; 240 goto Lᛑ; 241 LḆ: $t .= "Ḇ"; 242 swaplabel $t .= "ᶜ"; Lᶜ: 243 swaplabel $t .= "ᛑ"; Lᛑ: 244 Lᶟ: $t .= "ᶟ"; 245 }; 246 is $@, ""; 247 is $t, "ㅏᛑᶟ"; 248 249 $t = ""; 250 eval q{ 251 use XS::APItest qw(swaplabel); 252 $t .= "ㅏ"; 253 goto Lᶟ; 254 LḆ: $t .= "Ḇ"; 255 swaplabel $t .= "ᶜ"; Lᶜ: 256 swaplabel $t .= "ᛑ"; Lᛑ: 257 Lᶟ: $t .= "ᶟ"; 258 }; 259 is $@, ""; 260 is $t, "ㅏᶟ"; 261 262 $t = ""; 263 eval q{ 264 use XS::APItest qw(swaplabel); 265 $t .= "ㅏ"; 266 swaplabel $t .= "Ḇ"; y: 267 $t .= "ᶜ"; 268 }; 269 isnt $@, ""; 270 is $t, ""; 271 272 $t = ""; 273 eval q{ 274 use XS::APItest qw(swaplabel); 275 if(1) { $t .= "ㅏ"; } 276 if(1) { $t .= "Ḇ"; } 277 swaplabel if(1) { $t .= "ᶜ"; } 278 swaplabel if(1) { $t .= "ᛑ"; } 279 if(1) { $t .= "ᶟ"; } 280 }; 281 is $@, ""; 282 is $t, "ㅏḆᶜᛑᶟ"; 283 284 $t = ""; 285 eval q{ 286 use XS::APItest qw(swaplabel); 287 if(1) { $t .= "ㅏ"; } 288 LḆ: if(1) { $t .= "Ḇ"; } 289 swaplabel if(1) { $t .= "ᶜ"; } Lᶜ: 290 swaplabel if(1) { $t .= "ᛑ"; } Lᛑ: 291 Lᶟ: if(1) { $t .= "ᶟ"; } 292 }; 293 is $@, ""; 294 is $t, "ㅏḆᶜᛑᶟ"; 295 296 $t = ""; 297 eval q{ 298 use XS::APItest qw(swaplabel); 299 if(1) { $t .= "ㅏ"; } 300 goto LḆ; 301 LḆ: if(1) { $t .= "Ḇ"; } 302 swaplabel if(1) { $t .= "ᶜ"; } Lᶜ: 303 swaplabel if(1) { $t .= "ᛑ"; } Lᛑ: 304 Lᶟ: if(1) { $t .= "ᶟ"; } 305 }; 306 is $@, ""; 307 is $t, "ㅏḆᶜᛑᶟ"; 308 309 $t = ""; 310 eval q{ 311 use XS::APItest qw(swaplabel); 312 if(1) { $t .= "ㅏ"; } 313 goto Lᶜ; 314 LḆ: if(1) { $t .= "Ḇ"; } 315 swaplabel if(1) { $t .= "ᶜ"; } Lᶜ: 316 swaplabel if(1) { $t .= "ᛑ"; } Lᛑ: 317 Lᶟ: if(1) { $t .= "ᶟ"; } 318 }; 319 is $@, ""; 320 is $t, "ㅏᶜᛑᶟ"; 321 322 $t = ""; 323 eval q{ 324 use XS::APItest qw(swaplabel); 325 if(1) { $t .= "ㅏ"; } 326 goto Lᛑ; 327 LḆ: if(1) { $t .= "Ḇ"; } 328 swaplabel if(1) { $t .= "ᶜ"; } Lᶜ: 329 swaplabel if(1) { $t .= "ᛑ"; } Lᛑ: 330 Lᶟ: if(1) { $t .= "ᶟ"; } 331 }; 332 is $@, ""; 333 is $t, "ㅏᛑᶟ"; 334 335 $t = ""; 336 eval q{ 337 use XS::APItest qw(swaplabel); 338 if(1) { $t .= "ㅏ"; } 339 goto Lᶟ; 340 LḆ: if(1) { $t .= "Ḇ"; } 341 swaplabel if(1) { $t .= "ᶜ"; } Lᶜ: 342 swaplabel if(1) { $t .= "ᛑ"; } Lᛑ: 343 Lᶟ: if(1) { $t .= "ᶟ"; } 344 }; 345 is $@, ""; 346 is $t, "ㅏᶟ"; 347 348 $t = ""; 349 eval q{ 350 use XS::APItest qw(swaplabel); 351 if(1) { $t .= "ㅏ"; } 352 swaplabel if(1) { $t .= "Ḇ"; } y: 353 if(1) { $t .= "ᶜ"; } 354 }; 355 isnt $@, ""; 356 is $t, ""; 357} 358 3591; 360