summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-01-08 11:52:00 +1200
committerChip Salzenberg <chip@atlantic.net>1997-01-08 11:52:00 +1200
commit28757baaaeaa3801dd997fad8b1f5f62c64a228e (patch)
tree207f182f2a7bbe578c2ac82a754f776d0bc25193 /t
parent26f45c0087f1216e071d7b395c24e01de531479d (diff)
downloadperl-28757baaaeaa3801dd997fad8b1f5f62c64a228e.tar.gz
[inseparable changes from patch from perl5.003_19 to perl5.003_20]
BUILD PROCESS Subject: Make Configure default to the first domain in /etc/resolv.conf From: Chip Salzenberg <chip@atlantic.net> Files: Configure Subject: Start all helper scripts with $startsh From: Chip Salzenberg <chip@atlantic.net> Files: Configure Subject: Support libperl.so under FreeBSD Date: Sun, 5 Jan 1997 22:41:49 +0100 From: Ollivier Robert <roberto@keltia.freenix.fr> Files: Configure Makefile.SH Msg-ID: <Mutt.19970105224149.roberto@keltia.freenix.fr> (applied based on p5p patch as commit b126116e5ae3d57fa007f8a42fd506805b35163b) CORE LANGUAGE CHANGES Subject: Rescind named closures From: Chip Salzenberg <chip@atlantic.net> Files: Makefile.SH op.c perly.c perly.c.diff perly.y pp_hot.c Subject: Fix: empty @_ when calling empty-proto subs without parens Date: Sat, 04 Jan 1997 10:29:04 +0000 From: Graham Barr <bodg@tiuk.ti.com> Files: perly.c perly.y (applied based on p5p patch as commit 3112f5de73952f91aa4e8005d9852dfddbcf0402) CORE PORTABILITY Subject: Configure/perl5/Compartmented Mode Workstation (fwd) Date: Mon, 06 Jan 1997 13:15:38 -0500 (EST) From: Andy Dougherty <doughera@fractal.phys.lafayette.edu> Files: Configure hints/dec_osf.sh private-msgid: <Pine.SOL.3.95.970106131505.1662C-100000@fractal.lafayette.ed Subject: Remove obsolete file "dl_os2.xs". From: Ilya Zakharevich <ilya@math.ohio-state.edu> Files: MANIFEST DOCUMENTATION Subject: tiny doc patches Date: Sat, 04 Jan 1997 11:12:13 -0500 From: Roderick Schertler <roderick@gate.net> Files: pod/perlapio.pod pod/perlnews.pod pod/perltoc.pod Msg-ID: <23338.852394333@eeyore.ibcinc.com> (applied based on p5p patch as commit b681178584626ba3718f1279845fd452317134c1) Subject: doc patch for defined on perlfunc.pod Date: 04 Jan 1997 21:28:30 -0500 From: Roderick Schertler <roderick@gate.net> Files: pod/perlfunc.pod Msg-ID: <pz91686ek1.fsf@eeyore.ibcinc.com> (applied based on p5p patch as commit 38e3adfd2e3d40b46e465482945c4f3de4bb50ef) Subject: doc patch: perldsc Date: 04 Jan 1997 21:25:58 -0500 From: Roderick Schertler <roderick@gate.net> Files: pod/perldsc.pod pod/perltoc.pod Msg-ID: <pzafqo6eo9.fsf@eeyore.ibcinc.com> (applied based on p5p patch as commit 4d42f92e5bf79556508016b7af91233b12e526eb) Subject: scalar caller doc fix Date: Mon, 06 Jan 1997 22:34:20 -0500 From: Roderick Schertler <roderick@gate.net> Files: pod/perlfunc.pod Msg-ID: <18245.852608060@eeyore.ibcinc.com> (applied based on p5p patch as commit 218104faecb0ec19e0f4f89e084959e757a5230f) Subject: Misc perlfunc updates From: Tom Christiansen <tchrist@mox.perl.com> Files: pod/perlfunc.pod pod/perltoc.pod LIBRARY AND EXTENSIONS Subject: sigaction() problems Date: Mon, 06 Jan 1997 15:42:04 -0500 From: Roderick Schertler <roderick@gate.net> Files: ext/POSIX/POSIX.pm ext/POSIX/POSIX.pod Msg-ID: <12808.852583324@eeyore.ibcinc.com> (applied based on p5p patch as commit 84e96f2bcc509ba2fb5d2c9608a30cc3cfdea41a) Subject: Fix importation of FileHandle methods; fix POSIX docs From: Chip Salzenberg <chip@atlantic.net> Files: ext/POSIX/POSIX.pm ext/POSIX/POSIX.pod lib/FileHandle.pm Subject: Patch: make hints files warn about db-recno failures Date: Sun, 5 Jan 1997 12:34:25 +0100 From: Dominic Dunlop <domo@slipper.ip.lu> Files: MANIFEST hints/aux.sh hints/broken-db.msg hints/freebsd.sh (applied based on p5p patch as commit 692df45da95e2b7d14c4560347ef4555bb40b621) OTHER CORE CHANGES Subject: Fix C< sub foo (&@); sub bar (&); foo {}, bar {}, bar {} > From: Chip Salzenberg <chip@atlantic.net> Files: perly.c perly.c.diff perly.y Subject: plug for safe/opcode leaks Date: Tue, 07 Jan 1997 17:20:46 -0500 From: Doug MacEachern <dougm@osf.org> Files: op.c Msg-ID: <199701072220.RAA02117@postman.osf.org> (applied based on p5p patch as commit 5cbfc2849d37f748a8facbcbf1c889c575943488) Subject: Fix Dynaloader failures with DProf Date: Mon, 06 Jan 1997 12:18:46 -0500 From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: pp_hot.c private-msgid: <199701061718.MAA26909@aatma.engin.umich.edu> TESTS Subject: New test: comp/proto.t Date: Mon, 06 Jan 1997 09:13:03 +0000 From: Graham Barr <bodg@tiuk.ti.com> Files: MANIFEST t/comp/proto.t (applied based on p5p patch as commit 8c1635e65dc1b3900503d444e985e3f0e5601454)
Diffstat (limited to 't')
-rwxr-xr-xt/comp/proto.t371
1 files changed, 371 insertions, 0 deletions
diff --git a/t/comp/proto.t b/t/comp/proto.t
index e69de29bb2..0d3de96a51 100755
--- a/t/comp/proto.t
+++ b/t/comp/proto.t
@@ -0,0 +1,371 @@
+#!./perl
+#
+# Contributed by Graham Barr <Graham.Barr@tiuk.ti.com>
+#
+# So far there are tests for the following prototypes.
+# none, () ($) ($@) ($%) ($;$) (&) (&\@) (&@) (%) (\%) (\@)
+#
+# It is impossible to test every prototype that can be specified, but
+# we should test as many as we can.
+
+use strict;
+
+print "1..74\n";
+
+my $i = 1;
+
+sub testing (&$) {
+ my $p = prototype(shift);
+ my $c = shift;
+ my $what = defined $c ? '(' . $p . ')' : 'no prototype';
+ print '#' x 25,"\n";
+ print '# Testing ',$what,"\n";
+ print '#' x 25,"\n";
+ print "not "
+ if((defined($p) && defined($c) && $p ne $c)
+ || (defined($p) != defined($c)));
+ printf "ok %d\n",$i++;
+}
+
+@_ = qw(a b c d);
+my @array;
+my %hash;
+
+##
+##
+##
+
+testing \&no_proto, undef;
+
+sub no_proto {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_)
+}
+
+print "not " unless 0 == no_proto();
+printf "ok %d\n",$i++;
+
+print "not " unless 1 == no_proto(5);
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == &no_proto;
+printf "ok %d\n",$i++;
+
+print "not " unless 1 == no_proto +6;
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == no_proto(@_);
+printf "ok %d\n",$i++;
+
+##
+##
+##
+
+
+testing \&no_args, '';
+
+sub no_args () {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_)
+}
+
+print "not " unless 0 == no_args();
+printf "ok %d\n",$i++;
+
+print "not " unless 0 == no_args;
+printf "ok %d\n",$i++;
+
+print "not " unless 5 == no_args +5;
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == &no_args;
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == &no_args(1,2);
+printf "ok %d\n",$i++;
+
+eval "no_args(1)";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+##
+##
+##
+
+testing \&one_args, '$';
+
+sub one_args ($) {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_)
+}
+
+print "not " unless 1 == one_args(1);
+printf "ok %d\n",$i++;
+
+print "not " unless 1 == one_args +5;
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == &one_args;
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == &one_args(1,2);
+printf "ok %d\n",$i++;
+
+eval "one_args(1,2)";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+eval "one_args()";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+sub one_a_args ($) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless @_ == 1 && $_[0] == 4;
+ printf "ok %d\n",$i++;
+}
+
+one_a_args(@_);
+
+##
+##
+##
+
+testing \&over_one_args, '$@';
+
+sub over_one_args ($@) {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_)
+}
+
+print "not " unless 1 == over_one_args(1);
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == over_one_args(1,2);
+printf "ok %d\n",$i++;
+
+print "not " unless 1 == over_one_args +5;
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == &over_one_args;
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == &over_one_args(1,2);
+printf "ok %d\n",$i++;
+
+print "not " unless 5 == &over_one_args(1,@_);
+printf "ok %d\n",$i++;
+
+eval "over_one_args()";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+sub over_one_a_args ($@) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless @_ >= 1 && $_[0] == 4;
+ printf "ok %d\n",$i++;
+}
+
+over_one_a_args(@_);
+over_one_a_args(@_,1);
+over_one_a_args(@_,1,2);
+over_one_a_args(@_,@_);
+
+##
+##
+##
+
+testing \&scalar_and_hash, '$%';
+
+sub scalar_and_hash ($%) {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_)
+}
+
+print "not " unless 1 == scalar_and_hash(1);
+printf "ok %d\n",$i++;
+
+print "not " unless 3 == scalar_and_hash(1,2,3);
+printf "ok %d\n",$i++;
+
+print "not " unless 1 == scalar_and_hash +5;
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == &scalar_and_hash;
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == &scalar_and_hash(1,2);
+printf "ok %d\n",$i++;
+
+print "not " unless 5 == &scalar_and_hash(1,@_);
+printf "ok %d\n",$i++;
+
+eval "scalar_and_hash()";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+sub scalar_and_hash_a ($@) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless @_ >= 1 && $_[0] == 4;
+ printf "ok %d\n",$i++;
+}
+
+scalar_and_hash_a(@_);
+scalar_and_hash_a(@_,1);
+scalar_and_hash_a(@_,1,2);
+scalar_and_hash_a(@_,@_);
+
+##
+##
+##
+
+testing \&one_or_two, '$;$';
+
+sub one_or_two ($;$) {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_)
+}
+
+print "not " unless 1 == one_or_two(1);
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == one_or_two(1,3);
+printf "ok %d\n",$i++;
+
+print "not " unless 1 == one_or_two +5;
+printf "ok %d\n",$i++;
+
+print "not " unless 4 == &one_or_two;
+printf "ok %d\n",$i++;
+
+print "not " unless 3 == &one_or_two(1,2,3);
+printf "ok %d\n",$i++;
+
+print "not " unless 5 == &one_or_two(1,@_);
+printf "ok %d\n",$i++;
+
+eval "one_or_two()";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+eval "one_or_two(1,2,3)";
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+sub one_or_two_a ($;$) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless @_ >= 1 && $_[0] == 4;
+ printf "ok %d\n",$i++;
+}
+
+one_or_two_a(@_);
+one_or_two_a(@_,1);
+one_or_two_a(@_,@_);
+
+##
+##
+##
+
+testing \&a_sub, '&';
+
+sub a_sub (&) {
+ print "# \@_ = (",join(",",@_),")\n";
+ &{$_[0]};
+}
+
+sub tmp_sub_1 { printf "ok %d\n",$i++ }
+
+a_sub { printf "ok %d\n",$i++ };
+a_sub \&tmp_sub_1;
+
+@array = ( \&tmp_sub_1 );
+eval 'a_sub @array';
+print "not " unless $@;
+printf "ok %d\n",$i++;
+
+##
+##
+##
+
+testing \&sub_aref, '&\@';
+
+sub sub_aref (&\@) {
+ print "# \@_ = (",join(",",@_),")\n";
+ my($sub,$array) = @_;
+ print "not " unless @_ == 2 && @{$array} == 4;
+ print map { &{$sub}($_) } @{$array}
+}
+
+@array = (qw(O K)," ", $i++);
+sub_aref { lc shift } @array;
+print "\n";
+
+##
+##
+##
+
+testing \&sub_array, '&@';
+
+sub sub_array (&@) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless @_ == 5;
+ my $sub = shift;
+ print map { &{$sub}($_) } @_
+}
+
+@array = (qw(O K)," ", $i++);
+sub_array { lc shift } @array;
+print "\n";
+
+##
+##
+##
+
+testing \&a_hash, '%';
+
+sub a_hash (%) {
+ print "# \@_ = (",join(",",@_),")\n";
+ scalar(@_);
+}
+
+print "not " unless 1 == a_hash 'a';
+printf "ok %d\n",$i++;
+
+print "not " unless 2 == a_hash 'a','b';
+printf "ok %d\n",$i++;
+
+##
+##
+##
+
+testing \&a_hash_ref, '\%';
+
+sub a_hash_ref (\%) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless ref($_[0]) && $_[0]->{'a'};
+ printf "ok %d\n",$i++;
+ $_[0]->{'b'} = 2;
+}
+
+%hash = ( a => 1);
+a_hash_ref %hash;
+print "not " unless $hash{'b'} == 2;
+printf "ok %d\n",$i++;
+
+##
+##
+##
+
+testing \&an_array_ref, '\@';
+
+sub an_array_ref (\@) {
+ print "# \@_ = (",join(",",@_),")\n";
+ print "not " unless ref($_[0]) && 1 == @{$_[0]};
+ printf "ok %d\n",$i++;
+ @{$_[0]} = (qw(ok)," ",$i++,"\n");
+}
+
+@array = ('a');
+an_array_ref @array;
+print "not " unless @array == 4;
+print @array;