Commit | Line | Data |
---|---|---|
adfe19db MHM |
1 | ################################################################################ |
2 | # | |
3 | # !!!!! Do NOT edit this file directly! !!!!! | |
4 | # | |
5 | # Edit mktests.PL and/or parts/inc/misc instead. | |
6 | # | |
cac25305 MHM |
7 | # This file was automatically generated from the definition files in the |
8 | # parts/inc/ subdirectory by mktests.PL. To learn more about how all this | |
9 | # works, please read the F<HACKERS> file that came with this distribution. | |
10 | # | |
adfe19db MHM |
11 | ################################################################################ |
12 | ||
13 | BEGIN { | |
14 | if ($ENV{'PERL_CORE'}) { | |
15 | chdir 't' if -d 't'; | |
0ff33da8 | 16 | @INC = ('../lib', '../ext/Devel-PPPort/t') if -d '../lib' && -d '../ext'; |
adfe19db MHM |
17 | require Config; import Config; |
18 | use vars '%Config'; | |
a745474a | 19 | if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) { |
adfe19db MHM |
20 | print "1..0 # Skip -- Perl configured without Devel::PPPort module\n"; |
21 | exit 0; | |
22 | } | |
23 | } | |
24 | else { | |
25 | unshift @INC, 't'; | |
26 | } | |
27 | ||
c07deaaf MHM |
28 | sub load { |
29 | eval "use Test"; | |
30 | require 'testutil.pl' if $@; | |
adfe19db | 31 | } |
c07deaaf | 32 | |
1eff2a3b | 33 | if (128) { |
c07deaaf | 34 | load(); |
1eff2a3b | 35 | plan(tests => 128); |
adfe19db MHM |
36 | } |
37 | } | |
38 | ||
39 | use Devel::PPPort; | |
40 | use strict; | |
91900b62 | 41 | BEGIN { $^W = 1; } |
adfe19db | 42 | |
236afa0a MHM |
43 | package Devel::PPPort; |
44 | use vars '@ISA'; | |
45 | require DynaLoader; | |
46 | @ISA = qw(DynaLoader); | |
47 | bootstrap Devel::PPPort; | |
48 | ||
49 | package main; | |
50 | ||
adfe19db MHM |
51 | use vars qw($my_sv @my_av %my_hv); |
52 | ||
adfe19db MHM |
53 | ok(&Devel::PPPort::boolSV(1)); |
54 | ok(!&Devel::PPPort::boolSV(0)); | |
55 | ||
56 | $_ = "Fred"; | |
57 | ok(&Devel::PPPort::DEFSV(), "Fred"); | |
58 | ok(&Devel::PPPort::UNDERBAR(), "Fred"); | |
59 | ||
a48dcd62 | 60 | if ("$]" >= 5.009002 && "$]" < 5.023 && "$]" < 5.023004) { |
0d0f8426 | 61 | eval q{ |
b2049988 | 62 | no warnings "deprecated"; |
e5b2cbd0 | 63 | no if $^V > v5.17.9, warnings => "experimental::lexical_topic"; |
0d0f8426 MHM |
64 | my $_ = "Tony"; |
65 | ok(&Devel::PPPort::DEFSV(), "Fred"); | |
66 | ok(&Devel::PPPort::UNDERBAR(), "Tony"); | |
67 | }; | |
68 | } | |
69 | else { | |
70 | ok(1); | |
71 | ok(1); | |
72 | } | |
73 | ||
51d6c659 MHM |
74 | my @r = &Devel::PPPort::DEFSV_modify(); |
75 | ||
76 | ok(@r == 3); | |
77 | ok($r[0], 'Fred'); | |
78 | ok($r[1], 'DEFSV'); | |
79 | ok($r[2], 'Fred'); | |
80 | ||
81 | ok(&Devel::PPPort::DEFSV(), "Fred"); | |
82 | ||
adfe19db MHM |
83 | eval { 1 }; |
84 | ok(!&Devel::PPPort::ERRSV()); | |
85 | eval { cannot_call_this_one() }; | |
86 | ok(&Devel::PPPort::ERRSV()); | |
87 | ||
88 | ok(&Devel::PPPort::gv_stashpvn('Devel::PPPort', 0)); | |
89 | ok(!&Devel::PPPort::gv_stashpvn('does::not::exist', 0)); | |
90 | ok(&Devel::PPPort::gv_stashpvn('does::not::exist', 1)); | |
91 | ||
92 | $my_sv = 1; | |
93 | ok(&Devel::PPPort::get_sv('my_sv', 0)); | |
94 | ok(!&Devel::PPPort::get_sv('not_my_sv', 0)); | |
95 | ok(&Devel::PPPort::get_sv('not_my_sv', 1)); | |
96 | ||
97 | @my_av = (1); | |
98 | ok(&Devel::PPPort::get_av('my_av', 0)); | |
99 | ok(!&Devel::PPPort::get_av('not_my_av', 0)); | |
100 | ok(&Devel::PPPort::get_av('not_my_av', 1)); | |
101 | ||
102 | %my_hv = (a=>1); | |
103 | ok(&Devel::PPPort::get_hv('my_hv', 0)); | |
104 | ok(!&Devel::PPPort::get_hv('not_my_hv', 0)); | |
105 | ok(&Devel::PPPort::get_hv('not_my_hv', 1)); | |
106 | ||
107 | sub my_cv { 1 }; | |
108 | ok(&Devel::PPPort::get_cv('my_cv', 0)); | |
109 | ok(!&Devel::PPPort::get_cv('not_my_cv', 0)); | |
110 | ok(&Devel::PPPort::get_cv('not_my_cv', 1)); | |
111 | ||
9132e1a3 | 112 | ok(Devel::PPPort::dXSTARG(42), 43); |
0d0f8426 MHM |
113 | ok(Devel::PPPort::dAXMARK(4711), 4710); |
114 | ||
115 | ok(Devel::PPPort::prepush(), 42); | |
116 | ||
117 | ok(join(':', Devel::PPPort::xsreturn(0)), 'test1'); | |
118 | ok(join(':', Devel::PPPort::xsreturn(1)), 'test1:test2'); | |
9132e1a3 | 119 | |
f2ab5a41 MHM |
120 | ok(Devel::PPPort::PERL_ABS(42), 42); |
121 | ok(Devel::PPPort::PERL_ABS(-13), 13); | |
122 | ||
a48dcd62 DIM |
123 | ok(Devel::PPPort::SVf(42), "$]" >= 5.004 ? '[42]' : '42'); |
124 | ok(Devel::PPPort::SVf('abc'), "$]" >= 5.004 ? '[abc]' : 'abc'); | |
f2ab5a41 | 125 | |
fd7af155 MHM |
126 | ok(&Devel::PPPort::Perl_ppaddr_t("FOO"), "foo"); |
127 | ||
7bb03b24 MHM |
128 | ok(&Devel::PPPort::ptrtests(), 63); |
129 | ||
94e22bd6 MH |
130 | ok(&Devel::PPPort::OpSIBLING_tests(), 0); |
131 | ||
a48dcd62 | 132 | if ("$]" >= 5.009000) { |
ea4b7f32 JH |
133 | eval q{ |
134 | ok(&Devel::PPPort::check_HeUTF8("hello"), "norm"); | |
135 | ok(&Devel::PPPort::check_HeUTF8("\N{U+263a}"), "utf8"); | |
136 | }; | |
137 | } else { | |
138 | ok(1, 1); | |
139 | ok(1, 1); | |
140 | } | |
141 | ||
94e22bd6 MH |
142 | @r = &Devel::PPPort::check_c_array(); |
143 | ok($r[0], 4); | |
144 | ok($r[1], "13"); | |
145 | ||
146 | ok(!Devel::PPPort::SvRXOK("")); | |
147 | ok(!Devel::PPPort::SvRXOK(bless [], "Regexp")); | |
148 | ||
a48dcd62 | 149 | if ("$]" < 5.005) { |
94e22bd6 MH |
150 | skip 'no qr// objects in this perl', 0; |
151 | skip 'no qr// objects in this perl', 0; | |
152 | } else { | |
153 | my $qr = eval 'qr/./'; | |
154 | ok(Devel::PPPort::SvRXOK($qr)); | |
155 | ok(Devel::PPPort::SvRXOK(bless $qr, "Surprise")); | |
156 | } | |
157 | ||
db834d60 KW |
158 | ok( Devel::PPPort::isBLANK(ord(" "))); |
159 | ok(! Devel::PPPort::isBLANK(ord("\n"))); | |
9dc2cc38 | 160 | |
db834d60 KW |
161 | ok( Devel::PPPort::isBLANK_A(ord("\t"))); |
162 | ok(! Devel::PPPort::isBLANK_A(ord("\r"))); | |
9dc2cc38 | 163 | |
db834d60 KW |
164 | ok( Devel::PPPort::isUPPER(ord("A"))); |
165 | ok(! Devel::PPPort::isUPPER(ord("a"))); | |
9dc2cc38 | 166 | |
db834d60 | 167 | ok( Devel::PPPort::isUPPER_A(ord("Z"))); |
9dc2cc38 KW |
168 | |
169 | # One of these two is uppercase in EBCDIC; the other in Latin1, but neither are | |
170 | # ASCII uppercase. | |
db834d60 KW |
171 | ok(! Devel::PPPort::isUPPER_A(ord(0xDC))); |
172 | ok(! Devel::PPPort::isUPPER_A(ord(0xFC))); | |
9dc2cc38 | 173 | |
db834d60 KW |
174 | ok( Devel::PPPort::isLOWER(ord("b"))); |
175 | ok(! Devel::PPPort::isLOWER(ord("B"))); | |
9dc2cc38 | 176 | |
db834d60 | 177 | ok( Devel::PPPort::isLOWER_A(ord("y"))); |
9dc2cc38 KW |
178 | |
179 | # One of these two is lowercase in EBCDIC; the other in Latin1, but neither are | |
180 | # ASCII lowercase. | |
db834d60 KW |
181 | ok(! Devel::PPPort::isLOWER_A(ord(0xDC))); |
182 | ok(! Devel::PPPort::isLOWER_A(ord(0xFC))); | |
9dc2cc38 | 183 | |
db834d60 KW |
184 | ok( Devel::PPPort::isALPHA(ord("C"))); |
185 | ok(! Devel::PPPort::isALPHA(ord("1"))); | |
9dc2cc38 | 186 | |
db834d60 KW |
187 | ok( Devel::PPPort::isALPHA_A(ord("x"))); |
188 | ok(! Devel::PPPort::isALPHA_A(0xDC)); | |
9dc2cc38 | 189 | |
db834d60 KW |
190 | ok( Devel::PPPort::isWORDCHAR(ord("_"))); |
191 | ok(! Devel::PPPort::isWORDCHAR(ord("@"))); | |
9dc2cc38 | 192 | |
db834d60 KW |
193 | ok( Devel::PPPort::isWORDCHAR_A(ord("2"))); |
194 | ok(! Devel::PPPort::isWORDCHAR_A(0xFC)); | |
9dc2cc38 | 195 | |
db834d60 KW |
196 | ok( Devel::PPPort::isALPHANUMERIC(ord("4"))); |
197 | ok(! Devel::PPPort::isALPHANUMERIC(ord("_"))); | |
9dc2cc38 | 198 | |
db834d60 KW |
199 | ok( Devel::PPPort::isALPHANUMERIC_A(ord("l"))); |
200 | ok(! Devel::PPPort::isALPHANUMERIC_A(0xDC)); | |
9dc2cc38 | 201 | |
db834d60 KW |
202 | ok( Devel::PPPort::isALNUM(ord("c"))); |
203 | ok(! Devel::PPPort::isALNUM(ord("}"))); | |
9dc2cc38 | 204 | |
db834d60 KW |
205 | ok( Devel::PPPort::isALNUM_A(ord("5"))); |
206 | ok(! Devel::PPPort::isALNUM_A(0xFC)); | |
9dc2cc38 | 207 | |
db834d60 KW |
208 | ok( Devel::PPPort::isDIGIT(ord("6"))); |
209 | ok(! Devel::PPPort::isDIGIT(ord("_"))); | |
9dc2cc38 | 210 | |
db834d60 KW |
211 | ok( Devel::PPPort::isDIGIT_A(ord("7"))); |
212 | ok(! Devel::PPPort::isDIGIT_A(0xDC)); | |
9dc2cc38 | 213 | |
db834d60 KW |
214 | ok( Devel::PPPort::isOCTAL(ord("7"))); |
215 | ok(! Devel::PPPort::isOCTAL(ord("8"))); | |
9dc2cc38 | 216 | |
db834d60 KW |
217 | ok( Devel::PPPort::isOCTAL_A(ord("0"))); |
218 | ok(! Devel::PPPort::isOCTAL_A(ord("9"))); | |
9dc2cc38 | 219 | |
db834d60 KW |
220 | ok( Devel::PPPort::isIDFIRST(ord("D"))); |
221 | ok(! Devel::PPPort::isIDFIRST(ord("1"))); | |
9dc2cc38 | 222 | |
db834d60 KW |
223 | ok( Devel::PPPort::isIDFIRST_A(ord("_"))); |
224 | ok(! Devel::PPPort::isIDFIRST_A(0xFC)); | |
9dc2cc38 | 225 | |
db834d60 KW |
226 | ok( Devel::PPPort::isIDCONT(ord("e"))); |
227 | ok(! Devel::PPPort::isIDCONT(ord("@"))); | |
9dc2cc38 | 228 | |
db834d60 KW |
229 | ok( Devel::PPPort::isIDCONT_A(ord("2"))); |
230 | ok(! Devel::PPPort::isIDCONT_A(0xDC)); | |
9dc2cc38 | 231 | |
db834d60 KW |
232 | ok( Devel::PPPort::isSPACE(ord(" "))); |
233 | ok(! Devel::PPPort::isSPACE(ord("_"))); | |
9dc2cc38 | 234 | |
db834d60 KW |
235 | ok( Devel::PPPort::isSPACE_A(ord("\cK"))); |
236 | ok(! Devel::PPPort::isSPACE_A(ord("F"))); | |
9dc2cc38 KW |
237 | |
238 | # This stresses the edge for ASCII machines, but happens to work on EBCDIC as | |
239 | # well | |
db834d60 KW |
240 | ok( Devel::PPPort::isASCII(0x7F)); |
241 | ok(! Devel::PPPort::isASCII(0x80)); | |
9dc2cc38 | 242 | |
db834d60 | 243 | ok( Devel::PPPort::isASCII_A(ord("9"))); |
9dc2cc38 KW |
244 | |
245 | # B6 is the PARAGRAPH SIGN in ASCII and EBCDIC | |
db834d60 | 246 | ok(! Devel::PPPort::isASCII_A(0xB6)); |
9dc2cc38 | 247 | |
db834d60 KW |
248 | ok( Devel::PPPort::isCNTRL(ord("\e"))); |
249 | ok(! Devel::PPPort::isCNTRL(ord(" "))); | |
9dc2cc38 | 250 | |
db834d60 KW |
251 | ok( Devel::PPPort::isCNTRL_A(ord("\a"))); |
252 | ok(! Devel::PPPort::isCNTRL_A(0xB6)); | |
9dc2cc38 | 253 | |
db834d60 KW |
254 | ok( Devel::PPPort::isPRINT(ord(" "))); |
255 | ok(! Devel::PPPort::isPRINT(ord("\n"))); | |
9dc2cc38 | 256 | |
db834d60 KW |
257 | ok( Devel::PPPort::isPRINT_A(ord("G"))); |
258 | ok(! Devel::PPPort::isPRINT_A(0xB6)); | |
9dc2cc38 | 259 | |
db834d60 KW |
260 | ok( Devel::PPPort::isGRAPH(ord("h"))); |
261 | ok(! Devel::PPPort::isGRAPH(ord(" "))); | |
9dc2cc38 | 262 | |
db834d60 KW |
263 | ok( Devel::PPPort::isGRAPH_A(ord("i"))); |
264 | ok(! Devel::PPPort::isGRAPH_A(0xB6)); | |
9dc2cc38 | 265 | |
db834d60 KW |
266 | ok( Devel::PPPort::isPUNCT(ord("#"))); |
267 | ok(! Devel::PPPort::isPUNCT(ord(" "))); | |
9dc2cc38 | 268 | |
db834d60 KW |
269 | ok( Devel::PPPort::isPUNCT_A(ord("*"))); |
270 | ok(! Devel::PPPort::isPUNCT_A(0xB6)); | |
9dc2cc38 | 271 | |
db834d60 KW |
272 | ok( Devel::PPPort::isXDIGIT(ord("A"))); |
273 | ok(! Devel::PPPort::isXDIGIT(ord("_"))); | |
9dc2cc38 | 274 | |
db834d60 KW |
275 | ok( Devel::PPPort::isXDIGIT_A(ord("9"))); |
276 | ok(! Devel::PPPort::isXDIGIT_A(0xDC)); | |
9dc2cc38 | 277 | |
db834d60 KW |
278 | ok( Devel::PPPort::isPSXSPC(ord(" "))); |
279 | ok(! Devel::PPPort::isPSXSPC(ord("k"))); | |
9dc2cc38 | 280 | |
db834d60 KW |
281 | ok( Devel::PPPort::isPSXSPC_A(ord("\cK"))); |
282 | ok(! Devel::PPPort::isPSXSPC_A(0xFC)); | |
9dc2cc38 | 283 | |
1eff2a3b KW |
284 | ok(&Devel::PPPort::av_top_index([1,2,3]), 2); |
285 | ok(&Devel::PPPort::av_tindex([1,2,3,4]), 3); | |
286 |