1use warnings; 2use strict; 3 4use Test::More tests => 32; 5 6BEGIN { $^H |= 0x20000; } 7 8my $t; 9 10$t = ""; 11eval q{ 12 use XS::APItest qw(labelconst); 13 $t .= "a"; 14 $t .= labelconst b:; 15 $t .= "c"; 16}; 17is $@, ""; 18is $t, "abc"; 19 20$t = ""; 21eval q{ 22 use XS::APItest qw(labelconst); 23 $t .= "a"; 24 $t .= "b" . labelconst FOO: . "c"; 25 $t .= "d"; 26}; 27is $@, ""; 28is $t, "abFOOcd"; 29 30$t = ""; 31eval q{ 32 use XS::APItest qw(labelconst); 33 $t .= "a"; 34 $t .= labelconst FOO :; 35 $t .= "b"; 36}; 37is $@, ""; 38is $t, "aFOOb"; 39 40$t = ""; 41eval q{ 42 use XS::APItest qw(labelconst); 43 $t .= "a"; 44 $t .= labelconst F_1B:; 45 $t .= "b"; 46}; 47is $@, ""; 48is $t, "aF_1Bb"; 49 50$t = ""; 51eval q{ 52 use XS::APItest qw(labelconst); 53 $t .= "a"; 54 $t .= labelconst _AB:; 55 $t .= "b"; 56}; 57is $@, ""; 58is $t, "a_ABb"; 59 60$t = ""; 61eval q{ 62 use XS::APItest qw(labelconst); 63 no warnings; 64 $t .= "a"; 65 $t .= labelconst 1AB:; 66 $t .= "b"; 67}; 68isnt $@, ""; 69is $t, ""; 70 71$t = ""; 72eval q{ 73 use XS::APItest qw(labelconst); 74 $t .= "a"; 75 $t .= labelconst :; 76 $t .= "b"; 77}; 78isnt $@, ""; 79is $t, ""; 80 81$t = ""; 82eval q{ 83 use XS::APItest qw(labelconst); 84 $t .= "a"; 85 $t .= labelconst ; 86 $t .= "b"; 87}; 88isnt $@, ""; 89is $t, ""; 90 91$t = ""; 92$t = do("./t/labelconst.aux"); 93is $@, ""; 94is $t, "FOOBARBAZQUUX"; 95 96{ 97 use utf8; 98 use open qw( :utf8 :std ); 99 100 $t = ""; 101 eval q{ 102 use XS::APItest qw(labelconst); 103 $t .= "ㅏ"; 104 $t .= labelconst ᛒ:; 105 $t .= "ḉ"; 106 }; 107 is $@, ""; 108 is $t, "ㅏᛒḉ"; 109 110 $t = ""; 111 eval q{ 112 use XS::APItest qw(labelconst); 113 $t .= "ㅏ"; 114 $t .= "ᛒ" . labelconst FǑǑ: . "ḉ"; 115 $t .= "d"; 116 }; 117 is $@, ""; 118 is $t, "ㅏᛒFǑǑḉd"; 119 120 $t = ""; 121 eval q{ 122 use XS::APItest qw(labelconst); 123 $t .= "ㅏ"; 124 $t .= labelconst FǑǑ :; 125 $t .= "ᛒ"; 126 }; 127 is $@, ""; 128 is $t, "ㅏFǑǑᛒ"; 129 130 $t = ""; 131 eval q{ 132 use XS::APItest qw(labelconst); 133 $t .= "ㅏ"; 134 $t .= labelconst F_1Ḅ:; 135 $t .= "ᛒ"; 136 }; 137 is $@, ""; 138 is $t, "ㅏF_1Ḅᛒ"; 139 140 $t = ""; 141 eval q{ 142 use XS::APItest qw(labelconst); 143 $t .= "ㅏ"; 144 $t .= labelconst _AḄ:; 145 $t .= "ᛒ"; 146 }; 147 is $@, ""; 148 is $t, "ㅏ_AḄᛒ"; 149 150 $t = ""; 151 eval q{ 152 use XS::APItest qw(labelconst); 153 no warnings; 154 $t .= "ㅏ"; 155 $t .= labelconst 1AḄ:; 156 $t .= "ᛒ"; 157 }; 158 isnt $@, ""; 159 is $t, ""; 160 161} 162 163{ 164 use utf8; 165 $t = ""; 166 $t = do("./t/labelconst_utf8.aux"); 167 is $@, ""; 168 is $t, "FǑǑBÀRᛒÀZQÙÙX"; 169} 170 1711; 172