xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/t/comp/bproto.t (revision 0:68f95e015346)
1*0Sstevel@tonic-gate#!./perl
2*0Sstevel@tonic-gate#
3*0Sstevel@tonic-gate# check if builtins behave as prototyped
4*0Sstevel@tonic-gate#
5*0Sstevel@tonic-gate
6*0Sstevel@tonic-gateBEGIN {
7*0Sstevel@tonic-gate    chdir 't' if -d 't';
8*0Sstevel@tonic-gate    @INC = '../lib';
9*0Sstevel@tonic-gate}
10*0Sstevel@tonic-gate
11*0Sstevel@tonic-gateprint "1..10\n";
12*0Sstevel@tonic-gate
13*0Sstevel@tonic-gatemy $i = 1;
14*0Sstevel@tonic-gate
15*0Sstevel@tonic-gatesub foo {}
16*0Sstevel@tonic-gatemy $bar = "bar";
17*0Sstevel@tonic-gate
18*0Sstevel@tonic-gatesub test_too_many {
19*0Sstevel@tonic-gate    eval $_[0];
20*0Sstevel@tonic-gate    print "not " unless $@ =~ /^Too many arguments/;
21*0Sstevel@tonic-gate    printf "ok %d\n",$i++;
22*0Sstevel@tonic-gate}
23*0Sstevel@tonic-gate
24*0Sstevel@tonic-gatesub test_no_error {
25*0Sstevel@tonic-gate    eval $_[0];
26*0Sstevel@tonic-gate    print "not " if $@;
27*0Sstevel@tonic-gate    printf "ok %d\n",$i++;
28*0Sstevel@tonic-gate}
29*0Sstevel@tonic-gate
30*0Sstevel@tonic-gatetest_too_many($_) for split /\n/,
31*0Sstevel@tonic-gateq[	defined(&foo, $bar);
32*0Sstevel@tonic-gate	undef(&foo, $bar);
33*0Sstevel@tonic-gate	uc($bar,$bar);
34*0Sstevel@tonic-gate];
35*0Sstevel@tonic-gate
36*0Sstevel@tonic-gatetest_no_error($_) for split /\n/,
37*0Sstevel@tonic-gateq[	scalar(&foo,$bar);
38*0Sstevel@tonic-gate	defined &foo, &foo, &foo;
39*0Sstevel@tonic-gate	undef &foo, $bar;
40*0Sstevel@tonic-gate	uc $bar,$bar;
41*0Sstevel@tonic-gate	grep(not($bar), $bar);
42*0Sstevel@tonic-gate	grep(not($bar, $bar), $bar);
43*0Sstevel@tonic-gate	grep((not $bar, $bar, $bar), $bar);
44*0Sstevel@tonic-gate];
45