This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add a regression test for change #29041
[perl5.git] / t / op / cproto.t
CommitLineData
c0222185
RGS
1#!./perl
2# Tests to ensure that we don't unexpectedly change prototypes of builtins
3
f26e2faa
JH
4BEGIN {
5 chdir 't' if -d 't';
6 @INC = '../lib';
7}
8
0e7f5727 9BEGIN { require './test.pl'; }
5458a98a 10plan tests => 238;
0e7f5727 11
c0222185
RGS
12while (<DATA>) {
13 chomp;
14 my ($keyword, $proto) = split;
15 if ($proto eq 'undef') {
16 ok( !defined prototype "CORE::".$keyword, $keyword );
17 }
18 elsif ($proto eq 'unknown') {
19 eval { prototype "CORE::".$keyword };
20 like( $@, qr/Can't find an opnumber for/, $keyword );
21 }
22 else {
23 is( "(".prototype("CORE::".$keyword).")", $proto, $keyword );
24 }
25}
26
27# the keyword list :
28
29__DATA__
30abs (;$)
31accept (**)
32alarm (;$)
33and ()
34atan2 ($$)
35bind (*$)
36binmode (*;$)
37bless ($;$)
38caller (;$)
39chdir (;$)
40chmod (@)
41chomp undef
42chop undef
43chown (@)
44chr (;$)
45chroot (;$)
46close (;*)
47closedir (*)
48cmp unknown
49connect (*$)
0d863452 50continue ()
c0222185
RGS
51cos (;$)
52crypt ($$)
53dbmclose (\%)
54dbmopen (\%$$)
55defined undef
56delete undef
57die (@)
58do undef
59dump ()
60each (\%)
61else undef
62elsif undef
63endgrent ()
64endhostent ()
65endnetent ()
66endprotoent ()
67endpwent ()
68endservent ()
69eof (;*)
70eq ($$)
5458a98a 71err ()
c0222185
RGS
72eval undef
73exec undef
74exists undef
75exit (;$)
76exp (;$)
77fcntl (*$$)
78fileno (*)
79flock (*$)
80for undef
81foreach undef
82fork ()
83format undef
84formline ($@)
85ge ($$)
86getc (;*)
87getgrent ()
88getgrgid ($)
89getgrnam ($)
90gethostbyaddr ($$)
91gethostbyname ($)
92gethostent ()
93getlogin ()
94getnetbyaddr ($$)
95getnetbyname ($)
96getnetent ()
97getpeername (*)
98getpgrp (;$)
99getppid ()
100getpriority ($$)
101getprotobyname ($)
102getprotobynumber ($)
103getprotoent ()
104getpwent ()
105getpwnam ($)
106getpwuid ($)
107getservbyname ($$)
108getservbyport ($$)
109getservent ()
110getsockname (*)
111getsockopt (*$$)
5458a98a 112given undef
c0222185
RGS
113glob undef
114gmtime (;$)
115goto undef
116grep undef
117gt ($$)
118hex (;$)
119if undef
120index ($$;$)
121int (;$)
122ioctl (*$$)
123join ($@)
124keys (\%)
125kill (@)
126last undef
127lc (;$)
128lcfirst (;$)
129le ($$)
130length (;$)
131link ($$)
132listen (*$)
133local undef
134localtime (;$)
135lock (\$)
136log (;$)
137lstat (*)
138lt ($$)
139m undef
140map undef
bdf1bb36 141mkdir (;$$)
c0222185
RGS
142msgctl ($$$)
143msgget ($$)
144msgrcv ($$$$$)
145msgsnd ($$$)
146my undef
147ne ($$)
148next undef
149no undef
150not ($)
151oct (;$)
152open (*;$@)
153opendir (*$)
154or ()
155ord (;$)
156our undef
157pack ($@)
158package undef
159pipe (**)
160pop (;\@)
161pos undef
162print undef
163printf undef
164prototype undef
165push (\@@)
166q undef
167qq undef
168qr undef
169quotemeta (;$)
170qw undef
171qx undef
172rand (;$)
173read (*\$$;$)
174readdir (*)
175readline (;*)
176readlink (;$)
177readpipe unknown
178recv (*\$$$)
179redo undef
180ref (;$)
181rename ($$)
182require undef
183reset (;$)
184return undef
185reverse (@)
186rewinddir (*)
187rindex ($$;$)
188rmdir (;$)
189s undef
5458a98a 190say (;*@)
c0222185
RGS
191scalar undef
192seek (*$$)
193seekdir (*$)
194select (;*)
195semctl ($$$$)
196semget ($$$)
197semop ($$)
198send (*$$;$)
199setgrent ()
200sethostent ($)
201setnetent ($)
bdf1bb36 202setpgrp (;$$)
c0222185
RGS
203setpriority ($$$)
204setprotoent ($)
205setpwent ()
206setservent ($)
207setsockopt (*$$$)
208shift (;\@)
209shmctl ($$$)
210shmget ($$$)
211shmread ($$$$)
212shmwrite ($$$$)
213shutdown (*$)
214sin (;$)
215sleep (;$)
216socket (*$$$)
217socketpair (**$$$)
218sort undef
219splice (\@;$$@)
220split undef
221sprintf ($@)
222sqrt (;$)
223srand (;$)
224stat (*)
5458a98a 225state undef
c0222185
RGS
226study undef
227sub undef
228substr ($$;$$)
229symlink ($$)
230syscall ($@)
231sysopen (*$$;$)
232sysread (*\$$;$)
233sysseek (*$$)
234system undef
235syswrite (*$;$$)
236tell (;*)
237telldir (*)
238tie undef
239tied undef
240time ()
241times ()
242tr undef
243truncate ($$)
244uc (;$)
245ucfirst (;$)
246umask (;$)
247undef undef
248unless undef
249unlink (@)
250unpack ($;$)
251unshift (\@@)
252untie undef
253until undef
254use undef
255utime (@)
256values (\%)
257vec ($$$)
258wait ()
259waitpid ($$)
260wantarray ()
261warn (@)
5458a98a 262when undef
c0222185
RGS
263while undef
264write (;*)
265x unknown
266xor ($$)
267y undef