SYN SYN
[p5sagit/p5-mst-13.2.git] / t / comp / proto.t
index 6d60342..f9731ee 100755 (executable)
 
 BEGIN {
     chdir 't' if -d 't';
-    unshift @INC, '../lib';
+    @INC = '../lib';
 }
 
 use strict;
 
-print "1..100\n";
+print "1..110\n";
 
 my $i = 1;
 
@@ -293,6 +293,25 @@ printf "ok %d\n",$i++;
 ##
 ##
 
+testing \&a_subx, '\&';
+
+sub a_subx (\&) {
+    print "# \@_ = (",join(",",@_),")\n";
+    &{$_[0]};
+}
+
+sub tmp_sub_2 { printf "ok %d\n",$i++ }
+a_subx &tmp_sub_2;
+
+@array = ( \&tmp_sub_2 );
+eval 'a_subx @array';
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+##
+##
+##
+
 testing \&sub_aref, '&\@';
 
 sub sub_aref (&\@) {
@@ -384,7 +403,7 @@ print "ok ", $i++, "\n";
 print "not " if defined prototype('CORE::system');
 print "ok ", $i++, "\n";
 
-print "# CORE::open => ($p)\nnot " if ($p = prototype('CORE::open')) ne '*;$';
+print "# CORE::open => ($p)\nnot " if ($p = prototype('CORE::open')) ne '*;$@';
 print "ok ", $i++, "\n";
 
 print "# CORE:Foo => ($p), \$@ => `$@'\nnot " 
@@ -448,11 +467,21 @@ star2 $star, $star, sub { print "ok $i\n"
 star2($star, $star, sub { print "ok $i\n"
                        if $_[0] eq 'FOO' and $_[1] eq 'FOO' }); $i++;
 star2 *FOO, *BAR, sub { print "ok $i\n"
-                       if $_[0] eq \*FOO and $_[0] eq \*BAR }; $i++;
+                       if $_[0] eq \*FOO and $_[1] eq \*BAR }; $i++;
 star2(*FOO, *BAR, sub { print "ok $i\n"
-                       if $_[0] eq \*FOO and $_[0] eq \*BAR }); $i++;
+                       if $_[0] eq \*FOO and $_[1] eq \*BAR }); $i++;
 star2 \*FOO, \*BAR, sub { no strict 'refs'; print "ok $i\n"
-                       if $_[0] eq \*{'FOO'} and $_[0] eq \*{'BAR'} }; $i++;
+                       if $_[0] eq \*{'FOO'} and $_[1] eq \*{'BAR'} }; $i++;
 star2(\*FOO, \*BAR, sub { no strict 'refs'; print "ok $i\n"
-                       if $_[0] eq \*{'FOO'} and $_[0] eq \*{'BAR'} }); $i++;
+                       if $_[0] eq \*{'FOO'} and $_[1] eq \*{'BAR'} }); $i++;
 
+# test scalarref prototype
+sub sreftest (\$$) {
+    print "ok $_[1]\n" if ref $_[0];
+}
+{
+    no strict 'vars';
+    sreftest my $sref, $i++;
+    sreftest($helem{$i}, $i++);
+    sreftest $aelem[0], $i++;
+}