This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make prototype("CORE::foo") return prototypes with _ when it should
[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;
59b085e1 14 (my $keyword, my $proto, local $TODO) = split " ", $_, 3;
c0222185
RGS
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__
59b085e1 30abs (_)
c0222185 31accept (**)
59b085e1 32alarm (_)
c0222185
RGS
33and ()
34atan2 ($$)
35bind (*$)
36binmode (*;$)
37bless ($;$)
38caller (;$)
39chdir (;$)
40chmod (@)
41chomp undef
42chop undef
43chown (@)
59b085e1
RGS
44chr (_)
45chroot (_)
c0222185
RGS
46close (;*)
47closedir (*)
48cmp unknown
49connect (*$)
0d863452 50continue ()
59b085e1 51cos (_)
c0222185
RGS
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 (;$)
59b085e1 76exp (_)
c0222185
RGS
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 ($$)
59b085e1 118hex (_)
c0222185
RGS
119if undef
120index ($$;$)
59b085e1 121int (_)
c0222185
RGS
122ioctl (*$$)
123join ($@)
124keys (\%)
125kill (@)
126last undef
59b085e1
RGS
127lc (_)
128lcfirst (_)
c0222185 129le ($$)
59b085e1 130length (_)
c0222185
RGS
131link ($$)
132listen (*$)
133local undef
134localtime (;$)
135lock (\$)
59b085e1 136log (_)
c0222185
RGS
137lstat (*)
138lt ($$)
139m undef
140map undef
59b085e1 141mkdir (_;$) this prototype is not supported
c0222185
RGS
142msgctl ($$$)
143msgget ($$)
144msgrcv ($$$$$)
145msgsnd ($$$)
146my undef
147ne ($$)
148next undef
149no undef
150not ($)
59b085e1 151oct (_)
c0222185
RGS
152open (*;$@)
153opendir (*$)
154or ()
59b085e1 155ord (_)
c0222185
RGS
156our undef
157pack ($@)
158package undef
159pipe (**)
160pop (;\@)
161pos undef
162print undef
163printf undef
164prototype undef
165push (\@@)
166q undef
167qq undef
168qr undef
59b085e1 169quotemeta (_)
c0222185
RGS
170qw undef
171qx undef
172rand (;$)
173read (*\$$;$)
174readdir (*)
175readline (;*)
59b085e1 176readlink (_)
c0222185
RGS
177readpipe unknown
178recv (*\$$$)
179redo undef
59b085e1 180ref (_)
c0222185
RGS
181rename ($$)
182require undef
183reset (;$)
184return undef
185reverse (@)
186rewinddir (*)
187rindex ($$;$)
59b085e1 188rmdir (_)
c0222185 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 (*$)
59b085e1 214sin (_)
c0222185
RGS
215sleep (;$)
216socket (*$$$)
217socketpair (**$$$)
218sort undef
219splice (\@;$$@)
220split undef
221sprintf ($@)
59b085e1 222sqrt (_)
c0222185
RGS
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 ($$)
59b085e1
RGS
244uc (_)
245ucfirst (_)
c0222185
RGS
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