3 # Tests for labels in UTF-8
9 skip_all_without_unicode_tables();
13 use open qw( :utf8 :std );
15 use feature qw 'unicode_strings evalbytes';
17 use charnames qw( :full );
22 pass("Sanity check, UTF-8 labels don't throw a syntax error.");
27 skip_if_miniperl("no dynamic loading, no Encode", 2);
28 no warnings 'exiting';
31 my $prog = 'last LOOP;';
36 is $@, '', "last with a UTF-8 label works,";
39 Encode::_utf8_off($prog);
41 like $@, qr/^Unrecognized character/, "..but turn off the UTF-8 flag and it explodes";
46 no warnings 'exiting';
49 like $@, qr/Label not found for "last E" at/u, "last's error is UTF-8 clean";
52 like $@, qr/Label not found for "redo E" at/u, "redo's error is UTF-8 clean";
55 like $@, qr/Label not found for "next E" at/u, "next's error is UTF-8 clean";
61 my $prog = "redo L\N{LATIN CAPITAL LETTER A WITH ACUTE}BEL";
64 is $e, '', "redo UTF8 works";
65 utf8::downgrade($prog);
68 use feature 'unicode_eval';
69 no warnings 'exiting';
74 like $@, qr/Unrecognized character/, "redo to downgradeable labels";
75 is $d, 0, "Latin-1 labels are reachable";
83 pass("goto UTF-8 LABEL works.");