xref: /openbsd-src/gnu/usr.bin/perl/ext/XS-APItest/t/labelconst.t (revision 5759b3d249badf144a6240f7eec4dcf9df003e6b)
1898184e3Ssthenuse warnings;
2898184e3Ssthenuse strict;
3898184e3Ssthen
4898184e3Ssthenuse Test::More tests => 32;
5898184e3Ssthen
6898184e3SsthenBEGIN { $^H |= 0x20000; }
7898184e3Ssthen
8898184e3Ssthenmy $t;
9898184e3Ssthen
10898184e3Ssthen$t = "";
11898184e3Sstheneval q{
12898184e3Ssthen	use XS::APItest qw(labelconst);
13898184e3Ssthen	$t .= "a";
14898184e3Ssthen	$t .= labelconst b:;
15898184e3Ssthen	$t .= "c";
16898184e3Ssthen};
17898184e3Ssthenis $@, "";
18898184e3Ssthenis $t, "abc";
19898184e3Ssthen
20898184e3Ssthen$t = "";
21898184e3Sstheneval q{
22898184e3Ssthen	use XS::APItest qw(labelconst);
23898184e3Ssthen	$t .= "a";
24898184e3Ssthen	$t .= "b" . labelconst FOO: . "c";
25898184e3Ssthen	$t .= "d";
26898184e3Ssthen};
27898184e3Ssthenis $@, "";
28898184e3Ssthenis $t, "abFOOcd";
29898184e3Ssthen
30898184e3Ssthen$t = "";
31898184e3Sstheneval q{
32898184e3Ssthen	use XS::APItest qw(labelconst);
33898184e3Ssthen	$t .= "a";
34898184e3Ssthen	$t .= labelconst FOO :;
35898184e3Ssthen	$t .= "b";
36898184e3Ssthen};
37898184e3Ssthenis $@, "";
38898184e3Ssthenis $t, "aFOOb";
39898184e3Ssthen
40898184e3Ssthen$t = "";
41898184e3Sstheneval q{
42898184e3Ssthen	use XS::APItest qw(labelconst);
43898184e3Ssthen	$t .= "a";
44898184e3Ssthen	$t .= labelconst F_1B:;
45898184e3Ssthen	$t .= "b";
46898184e3Ssthen};
47898184e3Ssthenis $@, "";
48898184e3Ssthenis $t, "aF_1Bb";
49898184e3Ssthen
50898184e3Ssthen$t = "";
51898184e3Sstheneval q{
52898184e3Ssthen	use XS::APItest qw(labelconst);
53898184e3Ssthen	$t .= "a";
54898184e3Ssthen	$t .= labelconst _AB:;
55898184e3Ssthen	$t .= "b";
56898184e3Ssthen};
57898184e3Ssthenis $@, "";
58898184e3Ssthenis $t, "a_ABb";
59898184e3Ssthen
60898184e3Ssthen$t = "";
61898184e3Sstheneval q{
62898184e3Ssthen	use XS::APItest qw(labelconst);
63898184e3Ssthen	no warnings;
64898184e3Ssthen	$t .= "a";
65898184e3Ssthen	$t .= labelconst 1AB:;
66898184e3Ssthen	$t .= "b";
67898184e3Ssthen};
68898184e3Ssthenisnt $@, "";
69898184e3Ssthenis $t, "";
70898184e3Ssthen
71898184e3Ssthen$t = "";
72898184e3Sstheneval q{
73898184e3Ssthen	use XS::APItest qw(labelconst);
74898184e3Ssthen	$t .= "a";
75898184e3Ssthen	$t .= labelconst :;
76898184e3Ssthen	$t .= "b";
77898184e3Ssthen};
78898184e3Ssthenisnt $@, "";
79898184e3Ssthenis $t, "";
80898184e3Ssthen
81898184e3Ssthen$t = "";
82898184e3Sstheneval q{
83898184e3Ssthen	use XS::APItest qw(labelconst);
84898184e3Ssthen	$t .= "a";
85898184e3Ssthen	$t .= labelconst ;
86898184e3Ssthen	$t .= "b";
87898184e3Ssthen};
88898184e3Ssthenisnt $@, "";
89898184e3Ssthenis $t, "";
90898184e3Ssthen
91898184e3Ssthen$t = "";
92*5759b3d2Safresh1$t = do("./t/labelconst.aux");
93898184e3Ssthenis $@, "";
94898184e3Ssthenis $t, "FOOBARBAZQUUX";
95898184e3Ssthen
96898184e3Ssthen{
97898184e3Ssthen    use utf8;
98898184e3Ssthen    use open qw( :utf8 :std );
99898184e3Ssthen
100898184e3Ssthen    $t = "";
101898184e3Ssthen    eval q{
102898184e3Ssthen            use XS::APItest qw(labelconst);
103898184e3Ssthen            $t .= "ㅏ";
104898184e3Ssthen            $t .= labelconst ᛒ:;
105898184e3Ssthen            $t .= "ḉ";
106898184e3Ssthen    };
107898184e3Ssthen    is $@, "";
108898184e3Ssthen    is $t, "ㅏᛒḉ";
109898184e3Ssthen
110898184e3Ssthen    $t = "";
111898184e3Ssthen    eval q{
112898184e3Ssthen            use XS::APItest qw(labelconst);
113898184e3Ssthen            $t .= "ㅏ";
114898184e3Ssthen            $t .= "ᛒ" . labelconst FǑǑ: . "ḉ";
115898184e3Ssthen            $t .= "d";
116898184e3Ssthen    };
117898184e3Ssthen    is $@, "";
118898184e3Ssthen    is $t, "ㅏᛒFǑǑḉd";
119898184e3Ssthen
120898184e3Ssthen    $t = "";
121898184e3Ssthen    eval q{
122898184e3Ssthen            use XS::APItest qw(labelconst);
123898184e3Ssthen            $t .= "ㅏ";
124898184e3Ssthen            $t .= labelconst FǑǑ :;
125898184e3Ssthen            $t .= "ᛒ";
126898184e3Ssthen    };
127898184e3Ssthen    is $@, "";
128898184e3Ssthen    is $t, "ㅏFǑǑᛒ";
129898184e3Ssthen
130898184e3Ssthen    $t = "";
131898184e3Ssthen    eval q{
132898184e3Ssthen            use XS::APItest qw(labelconst);
133898184e3Ssthen            $t .= "ㅏ";
134898184e3Ssthen            $t .= labelconst F_1Ḅ:;
135898184e3Ssthen            $t .= "ᛒ";
136898184e3Ssthen    };
137898184e3Ssthen    is $@, "";
138898184e3Ssthen    is $t, "ㅏF_1Ḅᛒ";
139898184e3Ssthen
140898184e3Ssthen    $t = "";
141898184e3Ssthen    eval q{
142898184e3Ssthen            use XS::APItest qw(labelconst);
143898184e3Ssthen            $t .= "ㅏ";
144898184e3Ssthen            $t .= labelconst _AḄ:;
145898184e3Ssthen            $t .= "ᛒ";
146898184e3Ssthen    };
147898184e3Ssthen    is $@, "";
148898184e3Ssthen    is $t, "ㅏ_AḄᛒ";
149898184e3Ssthen
150898184e3Ssthen    $t = "";
151898184e3Ssthen    eval q{
152898184e3Ssthen            use XS::APItest qw(labelconst);
153898184e3Ssthen            no warnings;
154898184e3Ssthen            $t .= "ㅏ";
155898184e3Ssthen            $t .= labelconst 1AḄ:;
156898184e3Ssthen            $t .= "ᛒ";
157898184e3Ssthen    };
158898184e3Ssthen    isnt $@, "";
159898184e3Ssthen    is $t, "";
160898184e3Ssthen
161898184e3Ssthen}
162898184e3Ssthen
163898184e3Ssthen{
164898184e3Ssthen    use utf8;
165898184e3Ssthen    $t = "";
166*5759b3d2Safresh1    $t = do("./t/labelconst_utf8.aux");
167898184e3Ssthen    is $@, "";
168898184e3Ssthen    is $t, "FǑǑBÀRᛒÀZQÙÙX";
169898184e3Ssthen}
170898184e3Ssthen
171898184e3Ssthen1;
172