summaryrefslogtreecommitdiff
path: root/t/comp
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-02-07 09:30:47 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-02-07 09:30:47 +0000
commit62c18ce2c158fdc3401f5009417ddcfd1effff4a (patch)
treed2a8ffb909a7e8eee3ed9b0b8d9101e612b93589 /t/comp
parentc8984b0bd19897e6e30588055ac0338326f20a34 (diff)
downloadperl-62c18ce2c158fdc3401f5009417ddcfd1effff4a.tar.gz
properly prototype check parenthesized unary ops (e.g. defined(&a,&b))
p4raw-id: //depot/perl@2817
Diffstat (limited to 't/comp')
-rwxr-xr-xt/comp/bproto.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/comp/bproto.t b/t/comp/bproto.t
new file mode 100755
index 0000000000..699ea57a36
--- /dev/null
+++ b/t/comp/bproto.t
@@ -0,0 +1,41 @@
+#!./perl
+#
+# check if builtins behave as prototyped
+#
+
+BEGIN {
+ chdir 't' if -d 't';
+ unshift @INC, '../lib';
+}
+
+print "1..7\n";
+
+my $i = 1;
+
+sub foo {}
+my $bar = "bar";
+
+sub test_too_many {
+ eval $_[0];
+ print "not " unless $@ =~ /^Too many arguments/;
+ printf "ok %d\n",$i++;
+}
+
+sub test_no_error {
+ eval $_[0];
+ print "not " if $@;
+ printf "ok %d\n",$i++;
+}
+
+test_too_many($_) for split /\n/,
+q[ defined(&foo, $bar);
+ undef(&foo, $bar);
+ uc($bar,$bar);
+];
+
+test_no_error($_) for split /\n/,
+q[ scalar(&foo,$bar);
+ defined &foo, &foo, &foo;
+ undef &foo, $bar;
+ uc $bar,$bar;
+];