From 39d11b7fff60fb4dbe9c17fee36ce5399b4376d8 Mon Sep 17 00:00:00 2001
From: Tony Bowden <tony@kasei.com>
Date: Sat, 25 Aug 2001 15:58:17 +0100
Subject: Re: 'can' with undefined subs Message-Id:
 <20010825145817.A11788@soto.kasei.com>        (Applied with minor
 modifications.)

p4raw-id: //depot/perl@11752
---
 t/op/universal.t | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

(limited to 't')

diff --git a/t/op/universal.t b/t/op/universal.t
index 23c616c2b1..b6596a3c95 100755
--- a/t/op/universal.t
+++ b/t/op/universal.t
@@ -24,7 +24,8 @@ package Female;
 
 package Alice;
 @ISA=qw(Bob Female);
-sub drink {}
+sub sing;
+sub drink { return "drinking " . $_[1]  }
 sub new { bless {} }
 
 $Alice::VERSION = 2.718;
@@ -44,8 +45,9 @@ $Alice::VERSION = 2.718;
 
 package main;
 
-my $i = 2;
-sub test { print "not " unless shift; print "ok $i\n"; $i++; }
+{ my $i = 2;
+  sub test { print "not " unless shift; print "ok $i\n"; $i++; }
+}
 
 $a = new Alice;
 
@@ -61,11 +63,13 @@ test ! $a->isa("Male");
 
 test ! $a->isa('Programmer');
 
-test $a->can("drink");
-
 test $a->can("eat");
-
 test ! $a->can("sleep");
+test my $ref = $a->can("drink");        # returns a coderef
+test $a->$ref("tea") eq "drinking tea"; # ... which works
+test $ref = $a->can("sing");
+eval { $a->sing };
+test $@;                                # ... but not if no actual subroutine
 
 test (!Cedric->isa('Programmer'));
 
-- 
cgit v1.2.1


From 22b06de744d1b685a9c1a1b45c185462e07e12ee Mon Sep 17 00:00:00 2001
From: Nicholas Clark <nick@ccl4.org>
Date: Sun, 26 Aug 2001 10:48:22 +0100
Subject: op/universal.t failing Message-Id:
 <20010826094822.B4950@plum.flirble.org>

p4raw-id: //depot/perl@11753
---
 t/op/universal.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 't')

diff --git a/t/op/universal.t b/t/op/universal.t
index b6596a3c95..a67c77f2c3 100755
--- a/t/op/universal.t
+++ b/t/op/universal.t
@@ -9,7 +9,7 @@ BEGIN {
     $| = 1;
 }
 
-print "1..84\n";
+print "1..87\n";
 
 $a = {};
 bless $a, "Bob";
-- 
cgit v1.2.1


From 444e39b5b9f36cd0f60283ca4c60fc108157921f Mon Sep 17 00:00:00 2001
From: Nicholas Clark <nick@ccl4.org>
Date: Sun, 26 Aug 2001 13:03:05 +0100
Subject: t/io/binmode.t Message-Id: <20010826120305.C4950@plum.flirble.org>

(Also a nitpick in #11752 to t/op/universal.t)

p4raw-id: //depot/perl@11754
---
 t/io/binmode.t   | 18 +++++++++++++-----
 t/op/universal.t |  2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)

(limited to 't')

diff --git a/t/io/binmode.t b/t/io/binmode.t
index 76fd5a7779..34a462d9f9 100644
--- a/t/io/binmode.t
+++ b/t/io/binmode.t
@@ -5,16 +5,24 @@ BEGIN {
     @INC = '../lib';
 }
 
-
 use Test::More tests => 8;
+use Config;
 
 ok( binmode(STDERR),            'STDERR made binary' );
-ok( binmode(STDERR, ":unix"),   '  with unix discipline' );
+if ($Config{useperlio}) {
+  ok( binmode(STDERR, ":unix"),   '  with unix discipline' );
+} else {
+  ok(1,   '  skip unix discipline for -Uuseperlio' );
+}
 ok( binmode(STDERR, ":raw"),    '  raw' );
 ok( binmode(STDERR, ":crlf"),   '  and crlf' );
 
 # If this one fails, we're in trouble.  So we just bail out.
 ok( binmode(STDOUT),            'STDOUT made binary' )      || exit(1);
-ok( binmode(STDOUT, ":unix"),   '  with unix discipline' );
-ok( binmode(STDERR, ":raw"),    '  raw' );
-ok( binmode(STDERR, ":crlf"),   '  and crlf' );
+if ($Config{useperlio}) {
+  ok( binmode(STDOUT, ":unix"),   '  with unix discipline' );
+} else {
+  ok(1,   '  skip unix discipline for -Uuseperlio' );
+}
+ok( binmode(STDOUT, ":raw"),    '  raw' );
+ok( binmode(STDOUT, ":crlf"),   '  and crlf' );
diff --git a/t/op/universal.t b/t/op/universal.t
index a67c77f2c3..efda2a59be 100755
--- a/t/op/universal.t
+++ b/t/op/universal.t
@@ -68,7 +68,7 @@ test ! $a->can("sleep");
 test my $ref = $a->can("drink");        # returns a coderef
 test $a->$ref("tea") eq "drinking tea"; # ... which works
 test $ref = $a->can("sing");
-eval { $a->sing };
+eval { $a->$ref() };
 test $@;                                # ... but not if no actual subroutine
 
 test (!Cedric->isa('Programmer'));
-- 
cgit v1.2.1


From e5d18500ab9b6e628b63861d5ca05d19285ceda5 Mon Sep 17 00:00:00 2001
From: Abhijit Menon-Sen <ams@wiw.org>
Date: Mon, 27 Aug 2001 22:46:21 +0000
Subject: [PATCH] new tests for the coderef-in-@INC From: Rafael Garcia-Suarez
 <rgarciasuarez@free.fr> Date: Mon, 27 Aug 2001 22:36:27 +0200 Message-Id:
 <20010827223627.C690@rafael>

Subject: Re: [PATCH] new tests for the coderef-in-@INC
From: Nicholas Clark <nick@ccl4.org>
Date: Tue, 28 Aug 2001 00:02:46 +0100
Message-Id: <20010828000245.R4950@plum.flirble.org>

p4raw-id: //depot/perl@11764
---
 t/op/inccode.t | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 95 insertions(+)
 create mode 100644 t/op/inccode.t

(limited to 't')

diff --git a/t/op/inccode.t b/t/op/inccode.t
new file mode 100644
index 0000000000..9b35e84603
--- /dev/null
+++ b/t/op/inccode.t
@@ -0,0 +1,95 @@
+#!./perl -w
+
+# Tests for the coderef-in-@INC feature
+
+BEGIN {
+  chdir 't' if -d 't';
+  @INC = '../lib';
+}
+use Config;
+unless ($Config{useperlio}) {
+  print "1..0 # Skipping (tests are implemented using perlio features, this perl uses stdio)\n";
+  exit 0;
+}
+
+print "1..12\n";
+
+sub fooinc {
+    my ($self, $filename) = @_;
+    if (substr($filename,0,3) eq 'Foo') {
+	open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
+	return $fh;
+    }
+    else {
+	return undef;
+    }
+}
+
+push @INC, \&fooinc;
+
+print "not " if eval { require Bar };
+print "ok 1\n";
+print "not " if ! eval { require Foo }  or ! exists $INC{'Foo.pm'};
+print "ok 2\n";
+print "not " if ! eval "use Foo1; 1;"   or ! exists $INC{'Foo1.pm'};
+print "ok 3\n";
+print "not " if ! eval { do 'Foo2.pl' } or ! exists $INC{'Foo2.pl'};
+print "ok 4\n";
+
+pop @INC;
+
+sub fooinc2 {
+    my ($self, $filename) = @_;
+    if (substr($filename, 0, length($self->[1])) eq $self->[1]) {
+	open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
+	return $fh;
+    }
+    else {
+	return undef;
+    }
+}
+
+push @INC, [ \&fooinc2, 'Bar' ];
+
+print "not " if ! eval { require Foo }; # Already loaded
+print "ok 5\n";
+print "not " if eval { require Foo3 };
+print "ok 6\n";
+print "not " if ! eval { require Bar }  or ! exists $INC{'Bar.pm'};
+print "ok 7\n";
+print "not " if ! eval "use Bar1; 1;"   or ! exists $INC{'Bar1.pm'};
+print "ok 8\n";
+print "not " if ! eval { do 'Bar2.pl' } or ! exists $INC{'Bar2.pl'};
+print "ok 9\n";
+
+pop @INC;
+
+sub FooLoader::INC {
+    my ($self, $filename) = @_;
+    if (substr($filename,0,4) eq 'Quux') {
+	open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
+	return $fh;
+    }
+    else {
+	return undef;
+    }
+}
+
+push @INC, bless( {}, 'FooLoader' );
+
+print "not " if ! eval { require Quux } or ! exists $INC{'Quux.pm'};
+print "ok 10\n";
+
+pop @INC;
+
+push @INC, bless( [], 'FooLoader' );
+
+print "not " if ! eval { require Quux1 } or ! exists $INC{'Quux1.pm'};
+print "ok 11\n";
+
+pop @INC;
+
+push @INC, bless( \(my $x = 1), 'FooLoader' );
+
+print "not " if ! eval { require Quux2 } or ! exists $INC{'Quux2.pm'};
+print "ok 12\n";
-- 
cgit v1.2.1


From f8973f081d87ec67aa5cfc32129ad0144a08c6de Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Mon, 27 Aug 2001 15:47:30 -0400
Subject: Re: [PATCH] new tests for the coderef-in-@INC Message-Id:
 <20010827194730.C12582@blackrider>

p4raw-id: //depot/perl@11765
---
 t/op/inccode.t | 97 +++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 56 insertions(+), 41 deletions(-)

(limited to 't')

diff --git a/t/op/inccode.t b/t/op/inccode.t
index 9b35e84603..85a235d6de 100644
--- a/t/op/inccode.t
+++ b/t/op/inccode.t
@@ -1,95 +1,110 @@
-#!./perl -w
+#!./perl -wT
 
 # Tests for the coderef-in-@INC feature
 
 BEGIN {
-  chdir 't' if -d 't';
-  @INC = '../lib';
+    chdir 't' if -d 't';
+    @INC = '../lib';
 }
+
 use Config;
-unless ($Config{useperlio}) {
-  print "1..0 # Skipping (tests are implemented using perlio features, this perl uses stdio)\n";
-  exit 0;
-}
 
-print "1..12\n";
+BEGIN {
+    require Test::More;
+
+    # This test relies on perlio, but the feature being tested does not.
+    # The dependency should eventually be purged and use something like
+    # Tie::Handle instead.
+    if( $Config{useperlio} ) {
+        Test::More->import(tests => 21);
+    }
+    else {
+        Test::More->import('skip_all');
+    }
+}
 
 sub fooinc {
     my ($self, $filename) = @_;
     if (substr($filename,0,3) eq 'Foo') {
-	open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
-	return $fh;
+        open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
+        return $fh;
     }
     else {
-	return undef;
+        return undef;
     }
 }
 
 push @INC, \&fooinc;
 
-print "not " if eval { require Bar };
-print "ok 1\n";
-print "not " if ! eval { require Foo }  or ! exists $INC{'Foo.pm'};
-print "ok 2\n";
-print "not " if ! eval "use Foo1; 1;"   or ! exists $INC{'Foo1.pm'};
-print "ok 3\n";
-print "not " if ! eval { do 'Foo2.pl' } or ! exists $INC{'Foo2.pl'};
-print "ok 4\n";
+ok( !eval { require Bar; 1 },      'Trying non-magic package' );
+
+ok( eval { require Foo; 1 },       'require() magic via code ref'  ); 
+ok( exists $INC{'Foo.pm'},         '  %INC sees it' );
+
+ok( eval "use Foo1; 1;",           'use()' );  
+ok( exists $INC{'Foo1.pm'},        '  %INC sees it' );
+
+ok( eval { do 'Foo2.pl'; 1 },      'do()' ); 
+ok( exists $INC{'Foo2.pl'},        '  %INC sees it' );
 
 pop @INC;
 
+
 sub fooinc2 {
     my ($self, $filename) = @_;
     if (substr($filename, 0, length($self->[1])) eq $self->[1]) {
-	open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
-	return $fh;
+        open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
+        return $fh;
     }
     else {
-	return undef;
+        return undef;
     }
 }
 
 push @INC, [ \&fooinc2, 'Bar' ];
 
-print "not " if ! eval { require Foo }; # Already loaded
-print "ok 5\n";
-print "not " if eval { require Foo3 };
-print "ok 6\n";
-print "not " if ! eval { require Bar }  or ! exists $INC{'Bar.pm'};
-print "ok 7\n";
-print "not " if ! eval "use Bar1; 1;"   or ! exists $INC{'Bar1.pm'};
-print "ok 8\n";
-print "not " if ! eval { do 'Bar2.pl' } or ! exists $INC{'Bar2.pl'};
-print "ok 9\n";
+ok( eval { require Foo; 1; },     'Originally loaded packages preserved' );
+ok( !eval { require Foo3; 1; },   'Original magic INC purged' );
+
+ok( eval { require Bar; 1 },      'require() magic via array ref' );
+ok( exists $INC{'Bar.pm'},        '  %INC sees it' );
+
+ok( eval "use Bar1; 1;",          'use()' );
+ok( exists $INC{'Bar1.pm'},       '  %INC sees it' );
+
+ok( eval { do 'Bar2.pl'; 1 },     'do()' );
+ok( exists $INC{'Bar2.pl'},       '  %INC sees it' );
 
 pop @INC;
 
 sub FooLoader::INC {
     my ($self, $filename) = @_;
     if (substr($filename,0,4) eq 'Quux') {
-	open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
-	return $fh;
+        open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
+        return $fh;
     }
     else {
-	return undef;
+        return undef;
     }
 }
 
 push @INC, bless( {}, 'FooLoader' );
 
-print "not " if ! eval { require Quux } or ! exists $INC{'Quux.pm'};
-print "ok 10\n";
+ok( eval { require Quux; 1 },      'require() magic via hash object' );
+ok( exists $INC{'Quux.pm'},        '  %INC sees it' );
 
 pop @INC;
 
 push @INC, bless( [], 'FooLoader' );
 
-print "not " if ! eval { require Quux1 } or ! exists $INC{'Quux1.pm'};
-print "ok 11\n";
+ok( eval { require Quux1; 1 },     'require() magic via array object' );
+ok( exists $INC{'Quux1.pm'},       '  %INC sees it' );
 
 pop @INC;
 
 push @INC, bless( \(my $x = 1), 'FooLoader' );
 
-print "not " if ! eval { require Quux2 } or ! exists $INC{'Quux2.pm'};
-print "ok 12\n";
+ok( eval { require Quux2; 1 },     'require() magic via scalar object' );
+ok( exists $INC{'Quux2.pm'},       '  %INC sees it' );
+
+pop @INC;
-- 
cgit v1.2.1


From b23b8711f24117b1b40fef434605dd6c37711992 Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Mon, 27 Aug 2001 16:12:29 -0400
Subject: Fixing bad testing advice Message-Id:
 <20010827201229.D12582@blackrider>

p4raw-id: //depot/perl@11767
---
 t/op/pack.t | 45 ++++++++++++++++++++++++++-------------------
 1 file changed, 26 insertions(+), 19 deletions(-)

(limited to 't')

diff --git a/t/op/pack.t b/t/op/pack.t
index dfecc6e573..02247df053 100755
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -1,12 +1,25 @@
-#!./perl
+#!./perl -Tw
 
 BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
-    require Config; import Config;
+}
+
+use Config;
+
+$Is_EBCDIC = (defined $Config{ebcdic} && $Config{ebcdic} eq 'define');
+
+my $test = 1;
+sub ok {
+    my($ok) = @_;
+    print "not " unless $ok;
+    print "ok $test\n";
+    $test++;
+    return $ok;
 }
 
 print "1..161\n";
+
 # Note: All test numbers in comments are off by 1 after the comment below..
 
 $format = "c2 x5 C C x s d i l a6";
@@ -16,33 +29,29 @@ $format = "c2 x5 C C x s d i l a6";
 $foo = pack($format,@ary);
 @ary2 = unpack($format,$foo);
 
-print ($#ary == $#ary2 ? "ok 1\n" : "not ok 1\n");
+ok($#ary == $#ary2);
 
 $out1=join(':',@ary);
 $out2=join(':',@ary2);
 # Using long double NVs may introduce greater accuracy than wanted.
 $out1 =~ s/:9\.87654321097999\d*:/:9.87654321098:/;
 $out2 =~ s/:9\.87654321097999\d*:/:9.87654321098:/;
-print ($out1 eq $out2? "ok 2\n" : "not ok 2\n");
+ok($out1 eq $out2);
 
-print ($foo =~ /def/ ? "ok 3\n" : "not ok 3\n");
+ok($foo =~ /def/);
 
 # How about counting bits?
 
-print +($x = unpack("%32B*", "\001\002\004\010\020\040\100\200\377")) == 16
-	? "ok 4\n" : "not ok 4 $x\n";
+ok( ($x = unpack("%32B*", "\001\002\004\010\020\040\100\200\377")) == 16 );
 
-print +($x = unpack("%32b69", "\001\002\004\010\020\040\100\200\017")) == 12
-	? "ok 5\n" : "not ok 5 $x\n";
+ok( ($x = unpack("%32b69", "\001\002\004\010\020\040\100\200\017")) == 12 );
 
-print +($x = unpack("%32B69", "\001\002\004\010\020\040\100\200\017")) == 9
-	? "ok 6\n" : "not ok 6 $x\n";
+ok( ($x = unpack("%32B69", "\001\002\004\010\020\040\100\200\017")) == 9 );
 
 my $sum = 129; # ASCII
-$sum = 103 if ($Config{ebcdic} eq 'define');
+$sum = 103 if $Is_EBCDIC;
 
-print +($x = unpack("%32B*", "Now is the time for all good blurfl")) == $sum
-	? "ok 7\n" : "not ok 7 $x\n";
+ok( ($x = unpack("%32B*", "Now is the time for all good blurfl")) == $sum );
 
 open(BIN, "./perl") || open(BIN, "./perl.exe") || open(BIN, $^X)
     || die "Can't open ../perl or ../perl.exe: $!\n";
@@ -51,13 +60,11 @@ close BIN;
 
 $sum = unpack("%32b*", $foo);
 $longway = unpack("b*", $foo);
-print $sum == $longway =~ tr/1/1/ ? "ok 8\n" : "not ok 8\n";
+ok( $sum == $longway =~ tr/1/1/ );
 
-print +($x = unpack("I",pack("I", 0xFFFFFFFF))) == 0xFFFFFFFF
-	? "ok 9\n" : "not ok 9 $x\n";
+ok( ($x = unpack("I",pack("I", 0xFFFFFFFF))) == 0xFFFFFFFF );
 
 # check 'w'
-my $test=10;
 my @x = (5,130,256,560,32000,3097152,268435455,1073741844, 2**33,
          '4503599627365785','23728385234614992549757750638446');
 my $x = pack('w*', @x);
@@ -411,7 +418,7 @@ $test++;
 
 eval { ($x) = unpack 'a/a*/b*', '212ab' };
 my $expected_x = '100001100100';
-if ($Config{ebcdic} eq 'define') { $expected_x = '100000010100'; }
+if ($Is_EBCDIC) { $expected_x = '100000010100'; }
 print $@ eq '' && $x eq $expected_x ? "ok $test\n" : "#$x,$@\nnot ok $test\n";
 $test++;
 
-- 
cgit v1.2.1


From c274e827ea60addeb279fce8a64fd0960c08f01f Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Mon, 27 Aug 2001 17:24:44 -0400
Subject: Re: [PATCH pod/perlhack.pod t/op/pack.t] Fixing bad testing advice
 Message-Id: <20010827212444.F12582@blackrider>

p4raw-id: //depot/perl@11768
---
 t/op/pack.t | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

(limited to 't')

diff --git a/t/op/pack.t b/t/op/pack.t
index 02247df053..82568870aa 100755
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -12,12 +12,18 @@ $Is_EBCDIC = (defined $Config{ebcdic} && $Config{ebcdic} eq 'define');
 my $test = 1;
 sub ok {
     my($ok) = @_;
-    print "not " unless $ok;
-    print "ok $test\n";
+
+    # You have to do it this way or VMS will get confused.
+    my $out = '';
+    $out =  "not " unless $ok;
+    $out .= "ok $test\n";
+    print $out;
+
     $test++;
     return $ok;
 }
 
+
 print "1..161\n";
 
 # Note: All test numbers in comments are off by 1 after the comment below..
-- 
cgit v1.2.1


From 17639bde299d25109390c82720c805c9f43b1309 Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Tue, 28 Aug 2001 05:57:39 -0400
Subject: Adding the failure diagnostic Message-ID:
 <20010828095738.E17775@blackrider>

p4raw-id: //depot/perl@11772
---
 t/op/pack.t | 2 ++
 1 file changed, 2 insertions(+)

(limited to 't')

diff --git a/t/op/pack.t b/t/op/pack.t
index 82568870aa..1c6222efe7 100755
--- a/t/op/pack.t
+++ b/t/op/pack.t
@@ -19,6 +19,8 @@ sub ok {
     $out .= "ok $test\n";
     print $out;
 
+    printf "# Failed test at line %d\n", (caller)[2] unless $ok;
+
     $test++;
     return $ok;
 }
-- 
cgit v1.2.1


From 5a6e071df79535e06d0295e4c341673b1eeb8efc Mon Sep 17 00:00:00 2001
From: Paul Johnson <paul@pjcj.net>
Date: Wed, 29 Aug 2001 02:11:38 +0200
Subject: make coretest Message-Id: <20010829001138.B12169@pjcj.net> (Applied
 without the change to perlhack.pod. This should probably stay undocumented.)

p4raw-id: //depot/perl@11773
---
 t/TEST | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

(limited to 't')

diff --git a/t/TEST b/t/TEST
index 0a63f0e5f0..64da39ca4b 100755
--- a/t/TEST
+++ b/t/TEST
@@ -9,6 +9,7 @@ $| = 1;
 if ($#ARGV >= 0) {
     foreach my $idx (0..$#ARGV) {
 	next unless $ARGV[$idx] =~ /^-(\S+)$/;
+	$core    = 1 if $1 eq 'core';
 	$verbose = 1 if $1 eq 'v';
 	$with_utf= 1 if $1 eq 'utf8';
 	if ($1 =~ /^deparse(,.+)?$/) {
@@ -64,15 +65,20 @@ sub _find_tests {
 }
 
 unless (@ARGV) {
-    foreach my $dir (qw(base comp cmd run io op lib)) {
+    foreach my $dir (qw(base comp cmd run io op)) {
         _find_tests($dir);
     }
+    _find_tests("lib") unless $core;
     my $mani = File::Spec->catdir($updir, "MANIFEST");
     if (open(MANI, $mani)) {
         while (<MANI>) { # similar code in t/harness
 	    if (m!^(ext/\S+/([^/]+\.t|test\.pl)|lib/\S+?(\.t|test\.pl))\s!) {
-		push @ARGV, $1;
-		$OVER{$1} = File::Spec->catdir($updir, $1);
+		$t = $1;
+		if (!$core || $t =~ m!^lib/[a-z]!)
+		{
+		    push @ARGV, $t;
+		    $OVER{$t} = File::Spec->catdir($updir, $t);
+		}
 	    }
 	}
     } else {
-- 
cgit v1.2.1


From 47de4e93f8616edfbd1b8b8a2f1b803b497e9aa1 Mon Sep 17 00:00:00 2001
From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Wed, 29 Aug 2001 11:18:17 +0200
Subject: Re: [PATCH] newer tests for the coderef-in-@INC ! Message-Id:
 <20010829091817.A4453@rafael>

p4raw-id: //depot/perl@11782
---
 t/op/inccode.t | 68 ++++++++++++++++++++++++++++++++++++++--------------------
 1 file changed, 45 insertions(+), 23 deletions(-)

(limited to 't')

diff --git a/t/op/inccode.t b/t/op/inccode.t
index 85a235d6de..9173156bdf 100644
--- a/t/op/inccode.t
+++ b/t/op/inccode.t
@@ -7,27 +7,29 @@ BEGIN {
     @INC = '../lib';
 }
 
-use Config;
-
-BEGIN {
-    require Test::More;
+use File::Spec;
+use File::Temp qw/tempfile/;
+use Test::More tests => 30;
+
+sub get_temp_fh {
+    my ($fh,$f) = tempfile("DummyModuleXXXX", DIR => File::Spec->curdir,
+	UNLINK => 1);
+    print $fh "package ".substr($_[0],0,-3)."; 1;";
+    close $fh;
+    open $fh, $f or die "Can't open $f: $!";
+    return $fh;
+}
 
-    # This test relies on perlio, but the feature being tested does not.
-    # The dependency should eventually be purged and use something like
-    # Tie::Handle instead.
-    if( $Config{useperlio} ) {
-        Test::More->import(tests => 21);
-    }
-    else {
-        Test::More->import('skip_all');
-    }
+sub get_addr {
+    my $str = shift;
+    $str =~ /(0x[0-9a-f]+)/i;
+    return $1;
 }
 
 sub fooinc {
     my ($self, $filename) = @_;
     if (substr($filename,0,3) eq 'Foo') {
-        open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
-        return $fh;
+	return get_temp_fh($filename);
     }
     else {
         return undef;
@@ -40,12 +42,18 @@ ok( !eval { require Bar; 1 },      'Trying non-magic package' );
 
 ok( eval { require Foo; 1 },       'require() magic via code ref'  ); 
 ok( exists $INC{'Foo.pm'},         '  %INC sees it' );
+is( get_addr($INC{'Foo.pm'}), get_addr(\&fooinc),
+				   '  key is correct in %INC' );
 
 ok( eval "use Foo1; 1;",           'use()' );  
 ok( exists $INC{'Foo1.pm'},        '  %INC sees it' );
+is( get_addr($INC{'Foo1.pm'}), get_addr(\&fooinc),
+				   '  key is correct in %INC' );
 
 ok( eval { do 'Foo2.pl'; 1 },      'do()' ); 
 ok( exists $INC{'Foo2.pl'},        '  %INC sees it' );
+is( get_addr($INC{'Foo2.pl'}), get_addr(\&fooinc),
+				   '  key is correct in %INC' );
 
 pop @INC;
 
@@ -53,58 +61,72 @@ pop @INC;
 sub fooinc2 {
     my ($self, $filename) = @_;
     if (substr($filename, 0, length($self->[1])) eq $self->[1]) {
-        open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
-        return $fh;
+	return get_temp_fh($filename);
     }
     else {
         return undef;
     }
 }
 
-push @INC, [ \&fooinc2, 'Bar' ];
+my $arrayref = [ \&fooinc2, 'Bar' ];
+push @INC, $arrayref;
 
 ok( eval { require Foo; 1; },     'Originally loaded packages preserved' );
 ok( !eval { require Foo3; 1; },   'Original magic INC purged' );
 
 ok( eval { require Bar; 1 },      'require() magic via array ref' );
 ok( exists $INC{'Bar.pm'},        '  %INC sees it' );
+is( get_addr($INC{'Bar.pm'}), get_addr($arrayref),
+				   '  key is correct in %INC' );
 
 ok( eval "use Bar1; 1;",          'use()' );
 ok( exists $INC{'Bar1.pm'},       '  %INC sees it' );
+is( get_addr($INC{'Bar1.pm'}), get_addr($arrayref),
+				   '  key is correct in %INC' );
 
 ok( eval { do 'Bar2.pl'; 1 },     'do()' );
 ok( exists $INC{'Bar2.pl'},       '  %INC sees it' );
+is( get_addr($INC{'Bar2.pl'}), get_addr($arrayref),
+				   '  key is correct in %INC' );
 
 pop @INC;
 
 sub FooLoader::INC {
     my ($self, $filename) = @_;
     if (substr($filename,0,4) eq 'Quux') {
-        open my $fh, '<', \("package ".substr($filename,0,-3)."; 1;");
-        return $fh;
+	return get_temp_fh($filename);
     }
     else {
         return undef;
     }
 }
 
-push @INC, bless( {}, 'FooLoader' );
+my $href = bless( {}, 'FooLoader' );
+push @INC, $href;
 
 ok( eval { require Quux; 1 },      'require() magic via hash object' );
 ok( exists $INC{'Quux.pm'},        '  %INC sees it' );
+is( get_addr($INC{'Quux.pm'}), get_addr($href),
+				   '  key is correct in %INC' );
 
 pop @INC;
 
-push @INC, bless( [], 'FooLoader' );
+my $aref = bless( [], 'FooLoader' );
+push @INC, $aref;
 
 ok( eval { require Quux1; 1 },     'require() magic via array object' );
 ok( exists $INC{'Quux1.pm'},       '  %INC sees it' );
+is( get_addr($INC{'Quux1.pm'}), get_addr($aref),
+				   '  key is correct in %INC' );
 
 pop @INC;
 
-push @INC, bless( \(my $x = 1), 'FooLoader' );
+my $sref = bless( \(my $x = 1), 'FooLoader' );
+push @INC, $sref;
 
 ok( eval { require Quux2; 1 },     'require() magic via scalar object' );
 ok( exists $INC{'Quux2.pm'},       '  %INC sees it' );
+is( get_addr($INC{'Quux2.pm'}), get_addr($sref),
+				   '  key is correct in %INC' );
 
 pop @INC;
-- 
cgit v1.2.1


From 59d8ce6297a94889161c3324ccfdc9bb1a2d9d05 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <nick@ccl4.org>
Date: Wed, 29 Aug 2001 19:21:56 +0100
Subject: pass all tests when compiling with -DNO_PERL_PRESERVE_IVUV
 Message-Id: <20010829182156.O4950@plum.flirble.org>

p4raw-id: //depot/perl@11788
---
 t/op/64bitint.t   | 19 ++++++++++++++++++-
 t/op/numconvert.t |  8 +++++++-
 2 files changed, 25 insertions(+), 2 deletions(-)

(limited to 't')

diff --git a/t/op/64bitint.t b/t/op/64bitint.t
index e5ff95bf16..92b00d7783 100644
--- a/t/op/64bitint.t
+++ b/t/op/64bitint.t
@@ -14,10 +14,26 @@ BEGIN {
 
 # so that using > 0xfffffff constants and
 # 32+ bit integers don't cause noise
+use warnings;
 no warnings qw(overflow portable);
 
 print "1..59\n";
 
+# as 6 * 6 = 36, the last digit of 6**n will always be six. Hence the last
+# digit of 16**n will always be six. Hence 16**n - 1 will always end in 5.
+# Assumption is that UVs will always be a multiple of 4 bits long.
+
+my $UV_max = ~0;
+die "UV_max eq '$UV_max', doesn't end in 5; your UV isn't 4n bits long :-(."
+  unless $UV_max =~ /5$/;
+my $UV_max_less3 = $UV_max - 3;
+my $maths_preserves_UVs = $UV_max_less3 =~ /^\d+2$/;   # 5 - 3 is 2.
+if ($maths_preserves_UVs) {
+  print "# This perl's maths preserves all bits of a UV.\n";
+} else {
+  print "# This perl's maths does not preserve all bits of a UV.\n";
+}
+
 my $q = 12345678901;
 my $r = 23456789012;
 my $f = 0xffffffff;
@@ -327,7 +343,8 @@ print "ok 58\n";
 
 # 0xFFFFFFFFFFFFFFFF ==  1 * 3 * 5 * 17 * 257 * 641 * 65537 * 6700417'
 $q = 0xFFFFFFFFFFFFFFFF / 3;
-if ($q == 0x5555555555555555 and $q != 0x5555555555555556) {
+if ($q == 0x5555555555555555 and ($q != 0x5555555555555556
+                                  or !$maths_preserves_UVs)) {
   print "ok 59\n";
 } else {
   print "not ok 59 # 0xFFFFFFFFFFFFFFFF / 3 = $q\n";
diff --git a/t/op/numconvert.t b/t/op/numconvert.t
index 084092e534..fedef70d40 100755
--- a/t/op/numconvert.t
+++ b/t/op/numconvert.t
@@ -48,9 +48,11 @@ my $max_chain = $ENV{PERL_TEST_NUMCONVERTS} || 2;
 my $max_uv1 = ~0;
 my $max_uv2 = sprintf "%u", $max_uv1 ** 6; # 6 is an arbitrary number here
 my $big_iv = do {use integer; $max_uv1 * 16}; # 16 is an arbitrary number here
+my $max_uv_less3 = $max_uv1 - 3;
 
 print "# max_uv1 = $max_uv1, max_uv2 = $max_uv2, big_iv = $big_iv\n";
-if ($max_uv1 ne $max_uv2 or $big_iv > $max_uv1) {
+print "# max_uv_less3 = $max_uv_less3\n";
+if ($max_uv1 ne $max_uv2 or $big_iv > $max_uv1 or $max_uv1 == $max_uv_less3) {
   print "1..0 # skipped: unsigned perl arithmetic is not sane";
   eval { require Config; import Config };
   use vars qw(%Config);
@@ -60,6 +62,10 @@ if ($max_uv1 ne $max_uv2 or $big_iv > $max_uv1) {
   print "\n";
   exit 0;
 }
+if ($max_uv_less3 =~ tr/0-9//c) {
+  print "1..0 # skipped: this perl stringifies large unsigned integers using E notation\n";
+  exit 0;
+}
 
 my $st_t = 4*4;			# We try 4 initializers and 4 reporters
 
-- 
cgit v1.2.1


From e2c88acc9eb721d9206fdbfa8f5977ae2ccaa3c1 Mon Sep 17 00:00:00 2001
From: Nicholas Clark <nick@ccl4.org>
Date: Thu, 30 Aug 2001 19:20:54 +0100
Subject: pp_modulo Message-Id: <20010830182053.A4950@plum.flirble.org>

p4raw-id: //depot/perl@11794
---
 t/op/64bitint.t | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

(limited to 't')

diff --git a/t/op/64bitint.t b/t/op/64bitint.t
index 92b00d7783..5ea1f2dbdc 100644
--- a/t/op/64bitint.t
+++ b/t/op/64bitint.t
@@ -17,7 +17,7 @@ BEGIN {
 use warnings;
 no warnings qw(overflow portable);
 
-print "1..59\n";
+print "1..63\n";
 
 # as 6 * 6 = 36, the last digit of 6**n will always be six. Hence the last
 # digit of 16**n will always be six. Hence 16**n - 1 will always end in 5.
@@ -351,4 +351,32 @@ if ($q == 0x5555555555555555 and ($q != 0x5555555555555556
   print "# Should not be floating point\n" if $q =~ tr/e.//;
 }
 
+$q = 0xFFFFFFFFFFFFFFFF % 0x5555555555555555;
+if ($q == 0) {
+  print "ok 60\n";
+} else {
+  print "not ok 60 # 0xFFFFFFFFFFFFFFFF % 0x5555555555555555 => $q\n";
+}
+
+$q = 0xFFFFFFFFFFFFFFFF % 0xFFFFFFFFFFFFFFF0;
+if ($q == 0xF) {
+  print "ok 61\n";
+} else {
+  print "not ok 61 # 0xFFFFFFFFFFFFFFFF % 0xFFFFFFFFFFFFFFF0 => $q\n";
+}
+
+$q = 0x8000000000000000 % 9223372036854775807;
+if ($q == 1) {
+  print "ok 62\n";
+} else {
+  print "not ok 62 # 0x8000000000000000 % 9223372036854775807 => $q\n";
+}
+
+$q = 0x8000000000000000 % -9223372036854775807;
+if ($q == -9223372036854775806) {
+  print "ok 63\n";
+} else {
+  print "not ok 63 # 0x8000000000000000 % -9223372036854775807 => $q\n";
+}
+
 # eof
-- 
cgit v1.2.1


From bc769488d48dfc3f9427d7cf0b8a8f5098cc9d84 Mon Sep 17 00:00:00 2001
From: Abhijit Menon-Sen <ams@wiw.org>
Date: Fri, 31 Aug 2001 12:15:44 +0000
Subject: Integrate 11778 into mainline.

p4raw-id: //depot/perl@11799
---
 t/base/term.t | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 't')

diff --git a/t/base/term.t b/t/base/term.t
index 1d688b8f5b..000bff1b15 100755
--- a/t/base/term.t
+++ b/t/base/term.t
@@ -40,7 +40,12 @@ if (($x | 1) == 101) {print "ok 5\n";} else {print "not ok 5\n";}
 
 # check <> pseudoliteral
 
-open(try, "/dev/null") || open(try,"Dev:Null") || open(try,"nla0:") || (die "Can't open /dev/null.");
+if ($^O eq 'MacOS') {
+	open(try,"Dev:Null") || (die "Can't open /dev/null.");
+} else {
+	open(try, "/dev/null") || open(try,"nla0:") || (die "Can't open /dev/null.");
+}
+
 if (<try> eq '') {
     print "ok 6\n";
 }
-- 
cgit v1.2.1


From 949d010fe77e69674beb14306cfc1b92afa3e47c Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Fri, 31 Aug 2001 11:36:28 -0400
Subject: Re: [ID 20010831.001] SEGV from ($a, b) = (1, 2) Message-ID:
 <20010831153628.B598@blackrider> Check for things which used to segfault

p4raw-id: //depot/perl@11805
---
 t/run/segfault.t | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 t/run/segfault.t

(limited to 't')

diff --git a/t/run/segfault.t b/t/run/segfault.t
new file mode 100644
index 0000000000..e3bd8b64be
--- /dev/null
+++ b/t/run/segfault.t
@@ -0,0 +1,43 @@
+#!./perl
+#
+# Tests for things which have caused segfaults in the past.
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+# VMS and Windows need -e "...", most everything else works better with '
+my $quote = $^O =~ /^(VMS|MSWin\d+)$/ ? q{"} : q{'};
+
+my $IsVMS = $^O eq 'VMS';
+
+
+BEGIN {
+   if( $^O =~ /^(VMS|MSWin\d+)$/ ) {
+      print "1..0 # Skipped: platform temporarily not supported\n";
+      exit;
+   }
+}
+
+
+# Run some code, check that it has the expected output and exits
+# with the code for a perl syntax error.
+sub chk_segfault {
+    my($code, $expect, $name) = @_;
+    my $cmd = "$^X -e ";
+
+    # I *think* these are the right exit codes for syntax error.
+    my $expected_exit = $IsVMS ? 4 : 255;
+
+    my $out = `$cmd$quote$code$quote 2>&1`;
+
+    is( $? >> 8,    $expected_exit,     "$name - exit as expected" );
+    like( $out, qr/$expect at -e line 1/, '  with the right output' );
+}
+
+use Test::More tests => 2;
+
+chk_segfault('($a, b) = (1, 2)',  
+             "Can't modify constant item in list assignment",
+             'perlbug ID 20010831.001');
-- 
cgit v1.2.1


From 22e2837f3c603836f14e7ecdf873d47a2e95cda5 Mon Sep 17 00:00:00 2001
From: Rafael Garcia-Suarez <rgarciasuarez@gmail.com>
Date: Sat, 1 Sep 2001 16:50:14 +0200
Subject: , was t/op/incode.t breaks make minitest Message-ID:
 <20010901145014.A691@rafael>

p4raw-id: //depot/perl@11810
---
 t/op/inccode.t | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

(limited to 't')

diff --git a/t/op/inccode.t b/t/op/inccode.t
index 9173156bdf..95ee7c0094 100644
--- a/t/op/inccode.t
+++ b/t/op/inccode.t
@@ -8,18 +8,23 @@ BEGIN {
 }
 
 use File::Spec;
-use File::Temp qw/tempfile/;
 use Test::More tests => 30;
 
+my @tempfiles = ();
+
 sub get_temp_fh {
-    my ($fh,$f) = tempfile("DummyModuleXXXX", DIR => File::Spec->curdir,
-	UNLINK => 1);
+    my $f = "DummyModule0000";
+    1 while -e ++$f;
+    push @tempfiles, $f;
+    open my $fh, ">$f" or die "Can't create $f: $!";
     print $fh "package ".substr($_[0],0,-3)."; 1;";
     close $fh;
     open $fh, $f or die "Can't open $f: $!";
     return $fh;
 }
 
+END { 1 while unlink @tempfiles }
+
 sub get_addr {
     my $str = shift;
     $str =~ /(0x[0-9a-f]+)/i;
-- 
cgit v1.2.1


From 0dee299505be854b55f6a69aa322f436217cfe87 Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Sat, 1 Sep 2001 10:06:28 -0400
Subject: cleanup Message-ID: <20010901140628.C606@blackrider>

p4raw-id: //depot/perl@11812
---
 t/op/concat.t | 68 ++++++++++++++++++++++++++---------------------------------
 1 file changed, 30 insertions(+), 38 deletions(-)

(limited to 't')

diff --git a/t/op/concat.t b/t/op/concat.t
index 5ae7da51b9..4813690d6b 100644
--- a/t/op/concat.t
+++ b/t/op/concat.t
@@ -5,22 +5,28 @@ BEGIN {
     @INC = '../lib';
 }
 
-print "1..11\n";
+# This ok() function is specially written to avoid any concatenation.
+my $test = 1;
+sub ok {
+    my($ok, $name) = @_;
 
-($a, $b, $c) = qw(foo bar);
+    printf "%sok %d - %s\n", ($ok ? "" : "not "), $test, $name;
 
-print "not " unless "$a" eq "foo";
-print "ok 1\n";
+    printf "# Failed test at line %d\n", (caller)[2] unless $ok;
 
-print "not " unless "$a$b" eq "foobar";
-print "ok 2\n";
+    $test++;
+    return $ok;
+}
 
-print "not " unless "$c$a$c" eq "foo";
-print "ok 3\n";
+print "1..12\n";
 
-# Okay, so that wasn't very challenging.  Let's go Unicode.
+($a, $b, $c) = qw(foo bar);
+
+ok("$a"     eq "foo",    "verifying assign");
+ok("$a$b"   eq "foobar", "basic concatenation");
+ok("$c$a$c" eq "foo",    "concatenate undef, fore and aft");
 
-my $test = 4;
+# Okay, so that wasn't very challenging.  Let's go Unicode.
 
 {
     # bug id 20000819.004 
@@ -28,26 +34,20 @@ my $test = 4;
     $_ = $dx = "\x{10f2}";
     s/($dx)/$dx$1/;
     {
-	print "not " unless $_ eq "$dx$dx";
-	print "ok $test\n";
-	$test++;
+        ok($_ eq  "$dx$dx","bug id 20000819.004, back");
     }
 
     $_ = $dx = "\x{10f2}";
     s/($dx)/$1$dx/;
     {
-	print "not " unless $_ eq "$dx$dx";
-	print "ok $test\n";
-	$test++;
+        ok($_ eq  "$dx$dx","bug id 20000819.004, front");
     }
 
     $dx = "\x{10f2}";
     $_  = "\x{10f2}\x{10f2}";
     s/($dx)($dx)/$1$2/;
     {
-	print "not " unless $_ eq "$dx$dx";
-	print "ok $test\n";
-	$test++;
+        ok($_ eq  "$dx$dx","bug id 20000819.004, front and back");
     }
 }
 
@@ -57,9 +57,9 @@ my $test = 4;
 
     my $a;
     $a .= "\x{1ff}";
-    print "not " unless $a eq "\x{1ff}";
-    print "ok $test\n";
-    $test++;
+    ok($a eq  "\x{1ff}", "bug id 20000901.092, undef left");
+    $a .= undef;
+    ok($a eq  "\x{1ff}", "bug id 20000901.092, undef right");
 }
 
 {
@@ -69,29 +69,21 @@ my $test = 4;
 
     # Without the fix this 5.7.0 would croak:
     # Modification of a read-only value attempted at ...
-    "$2\x{1234}";
-
-    print "ok $test\n";
-    $test++;
+    eval {"$2\x{1234}"};
+    ok(!$@, "bug id 20001020.006, left");
 
     # For symmetry with the above.
-    "\x{1234}$2";
-
-    print "ok $test\n";
-    $test++;
+    eval {"\x{1234}$2"};
+    ok(!$@, "bug id 20001020.006, right");
 
     *pi = \undef;
     # This bug existed earlier than the $2 bug, but is fixed with the same
     # patch. Without the fix this 5.7.0 would also croak:
     # Modification of a read-only value attempted at ...
-    "$pi\x{1234}";
-
-    print "ok $test\n";
-    $test++;
+    eval{"$pi\x{1234}"};
+    ok(!$@, "bug id 20001020.006, constant left");
 
     # For symmetry with the above.
-    "\x{1234}$pi";
-
-    print "ok $test\n";
-    $test++;
+    eval{"\x{1234}$pi"};
+    ok(!$@, "bug id 20001020.006, constant right");
 }
-- 
cgit v1.2.1


From 75685a94f35c086cc598b03baf224ef3dc31936b Mon Sep 17 00:00:00 2001
From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Sat, 1 Sep 2001 23:02:09 +0000
Subject: Test tweaks.

p4raw-id: //depot/perl@11818
---
 t/op/pat.t | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 't')

diff --git a/t/op/pat.t b/t/op/pat.t
index 478e2994f0..2e8922523c 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -1989,6 +1989,8 @@ print "ok 683\n" if @a == 9 && "@a" eq "f o o \n $a $b b a r";
 }
 
 {
+    # [ID 20010407.006] matching utf8 return values from functions does not work
+
     package ID_20010407_006;
 
     sub x {
@@ -2000,7 +2002,7 @@ print "ok 683\n" if @a == 9 && "@a" eq "f o o \n $a $b b a r";
 
     $x =~ /(..)/; $y = $1;
     print "not " unless length($y) == 2 && $y eq $x;
-    print "ok 685\n" if length($y) == 2;
+    print "ok 685\n";
 
     x  =~ /(..)/; $y = $1;
     print "not " unless length($y) == 2 && $y eq $x;
-- 
cgit v1.2.1


From d8a34499b0ed1aed7c7d5741ef20a99cbe385896 Mon Sep 17 00:00:00 2001
From: Ilmari Karonen <iltzu@sci.fi>
Date: Sun, 19 Aug 2001 22:27:33 +0300
Subject: RE: [PATCH] Add a nextstate into empty blocks Message-Id:
 <Pine.SOL.3.96.1010819163840.8384B-100000@simpukka> (op/sub_lval.t updated to
 take new error message into account.)

p4raw-id: //depot/perl@11822
---
 t/op/sub_lval.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 't')

diff --git a/t/op/sub_lval.t b/t/op/sub_lval.t
index 350cb65e1a..4654118fa1 100755
--- a/t/op/sub_lval.t
+++ b/t/op/sub_lval.t
@@ -251,7 +251,7 @@ eval <<'EOE' or $_ = $@;
 EOE
 
 print "# '$_'.\nnot "
-  unless /Can\'t return a readonly value from lvalue subroutine/;
+  unless /Empty array returned from lvalue subroutine in scalar context/;
 print "ok 31\n";
 
 sub lv10 : lvalue {}
-- 
cgit v1.2.1


From c9beb3f55a1e5316151688ffb6caa12ed94c8f37 Mon Sep 17 00:00:00 2001
From: "Michael G. Schwern" <schwern@pobox.com>
Date: Sat, 1 Sep 2001 16:18:58 -0400
Subject: rm t/run/segfault.t; mv t/op/misc.t t/run/kill_perl.t Message-ID:
 <20010901201858.X606@blackrider> +MANIFEST Fix

p4raw-id: //depot/perl@11828
---
 t/op/misc.t       | 741 --------------------------------------------------
 t/run/kill_perl.t | 791 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 t/run/segfault.t  |  43 ---
 3 files changed, 791 insertions(+), 784 deletions(-)
 delete mode 100755 t/op/misc.t
 create mode 100644 t/run/kill_perl.t
 delete mode 100644 t/run/segfault.t

(limited to 't')

diff --git a/t/op/misc.t b/t/op/misc.t
deleted file mode 100755
index 3cfb667ec8..0000000000
--- a/t/op/misc.t
+++ /dev/null
@@ -1,741 +0,0 @@
-#!./perl
-
-# NOTE: Please don't add tests to this file unless they *need* to be run in
-# separate executable and can't simply use eval.
-
-chdir 't' if -d 't';
-@INC = '../lib';
-$ENV{PERL5LIB} = "../lib";
-
-$|=1;
-
-undef $/;
-@prgs = split "\n########\n", <DATA>;
-print "1..", scalar @prgs, "\n";
-
-$tmpfile = "misctmp000";
-1 while -f ++$tmpfile;
-END { while($tmpfile && unlink $tmpfile){} }
-
-$CAT = (($^O eq 'MSWin32') ? '.\perl -e "print <>"' : (($^O eq 'NetWare') ? 'perl -e "print <>"' : 'cat'));
-
-for (@prgs){
-    my $switch;
-    if (s/^\s*(-\w.*)//){
-	$switch = $1;
-    }
-    my($prog,$expected) = split(/\nEXPECT\n/, $_);
-    open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
-    $prog =~ s#/dev/null#NL:# if $^O eq 'VMS';     
-    $prog =~ s#if \(-e _ and -f _ and -r _\)#if (-e _ and -f _)# if $^O eq 'VMS';  # VMS file locking 
-
-    print TEST $prog, "\n";
-    close TEST or die "Cannot close $tmpfile: $!";
-
-    if ($^O eq 'MSWin32') {
-      $results = `.\\perl -I../lib $switch $tmpfile 2>&1`;
-    }
-	elsif ($^O eq 'NetWare') {
-      $results = `perl -I../lib $switch $tmpfile 2>&1`;
-    }
-    else {
-      $results = `./perl $switch $tmpfile 2>&1`;
-    }
-    $status = $?;
-    $results =~ s/\n+$//;
-    $results =~ s/at\s+misctmp\d+\s+line/at - line/g;
-    $results =~ s/of\s+misctmp\d+\s+aborted/of - aborted/g;
-# bison says 'parse error' instead of 'syntax error',
-# various yaccs may or may not capitalize 'syntax'.
-    $results =~ s/^(syntax|parse) error/syntax error/mig;
-    $results =~ s/\n\n/\n/ if $^O eq 'VMS'; # pipes double these sometimes
-    $expected =~ s/\n+$//;
-    if ( $results ne $expected ) {
-	print STDERR "PROG: $switch\n$prog\n";
-	print STDERR "EXPECTED:\n$expected\n";
-	print STDERR "GOT:\n$results\n";
-	print "not ";
-    }
-    print "ok ", ++$i, "\n";
-}
-
-__END__
-()=()
-########
-$a = ":="; split /($a)/o, "a:=b:=c"; print "@_"
-EXPECT
-a := b := c
-########
-$cusp = ~0 ^ (~0 >> 1);
-use integer;
-$, = " ";
-print +($cusp - 1) % 8, $cusp % 8, -$cusp % 8, 8 | (($cusp + 1) % 8 + 7), "!\n";
-EXPECT
-7 0 0 8 !
-########
-$foo=undef; $foo->go;
-EXPECT
-Can't call method "go" on an undefined value at - line 1.
-########
-BEGIN
-        {
-	    "foo";
-        }
-########
-$array[128]=1
-########
-$x=0x0eabcd; print $x->ref;
-EXPECT
-Can't call method "ref" without a package or object reference at - line 1.
-########
-chop ($str .= <DATA>);
-########
-close ($banana);
-########
-$x=2;$y=3;$x<$y ? $x : $y += 23;print $x;
-EXPECT
-25
-########
-eval {sub bar {print "In bar";}}
-########
-system './perl -ne "print if eof" /dev/null'
-########
-chop($file = <DATA>);
-########
-package N;
-sub new {my ($obj,$n)=@_; bless \$n}  
-$aa=new N 1;
-$aa=12345;
-print $aa;
-EXPECT
-12345
-########
-%@x=0;
-EXPECT
-Can't modify hash dereference in repeat (x) at - line 1, near "0;"
-Execution of - aborted due to compilation errors.
-########
-$_="foo";
-printf(STDOUT "%s\n", $_);
-EXPECT
-foo
-########
-push(@a, 1, 2, 3,)
-########
-quotemeta ""
-########
-for ("ABCDE") {
- &sub;
-s/./&sub($&)/eg;
-print;}
-sub sub {local($_) = @_;
-$_ x 4;}
-EXPECT
-Modification of a read-only value attempted at - line 3.
-########
-package FOO;sub new {bless {FOO => BAR}};
-package main;
-use strict vars;   
-my $self = new FOO;
-print $$self{FOO};
-EXPECT
-BAR
-########
-$_="foo";
-s/.{1}//s;
-print;
-EXPECT
-oo
-########
-print scalar ("foo","bar")
-EXPECT
-bar
-########
-sub by_number { $a <=> $b; };# inline function for sort below
-$as_ary{0}="a0";
-@ordered_array=sort by_number keys(%as_ary);
-########
-sub NewShell
-{
-  local($Host) = @_;
-  my($m2) = $#Shells++;
-  $Shells[$m2]{HOST} = $Host;
-  return $m2;
-}
- 
-sub ShowShell
-{
-  local($i) = @_;
-}
- 
-&ShowShell(&NewShell(beach,Work,"+0+0"));
-&ShowShell(&NewShell(beach,Work,"+0+0"));
-&ShowShell(&NewShell(beach,Work,"+0+0"));
-########
-   {
-       package FAKEARRAY;
-   
-       sub TIEARRAY
-       { print "TIEARRAY @_\n"; 
-         die "bomb out\n" unless $count ++ ;
-         bless ['foo'] 
-       }
-       sub FETCH { print "fetch @_\n"; $_[0]->[$_[1]] }
-       sub STORE { print "store @_\n"; $_[0]->[$_[1]] = $_[2] }
-       sub DESTROY { print "DESTROY \n"; undef @{$_[0]}; }
-   }
-   
-eval 'tie @h, FAKEARRAY, fred' ;
-tie @h, FAKEARRAY, fred ;
-EXPECT
-TIEARRAY FAKEARRAY fred
-TIEARRAY FAKEARRAY fred
-DESTROY 
-########
-BEGIN { die "phooey\n" }
-EXPECT
-phooey
-BEGIN failed--compilation aborted at - line 1.
-########
-BEGIN { 1/$zero }
-EXPECT
-Illegal division by zero at - line 1.
-BEGIN failed--compilation aborted at - line 1.
-########
-BEGIN { undef = 0 }
-EXPECT
-Modification of a read-only value attempted at - line 1.
-BEGIN failed--compilation aborted at - line 1.
-########
-{
-    package foo;
-    sub PRINT {
-        shift;
-        print join(' ', reverse @_)."\n";
-    }
-    sub PRINTF {
-        shift;
-	  my $fmt = shift;
-        print sprintf($fmt, @_)."\n";
-    }
-    sub TIEHANDLE {
-        bless {}, shift;
-    }
-    sub READLINE {
-	"Out of inspiration";
-    }
-    sub DESTROY {
-	print "and destroyed as well\n";
-  }
-  sub READ {
-      shift;
-      print STDOUT "foo->can(READ)(@_)\n";
-      return 100; 
-  }
-  sub GETC {
-      shift;
-      print STDOUT "Don't GETC, Get Perl\n";
-      return "a"; 
-  }    
-}
-{
-    local(*FOO);
-    tie(*FOO,'foo');
-    print FOO "sentence.", "reversed", "a", "is", "This";
-    print "-- ", <FOO>, " --\n";
-    my($buf,$len,$offset);
-    $buf = "string";
-    $len = 10; $offset = 1;
-    read(FOO, $buf, $len, $offset) == 100 or die "foo->READ failed";
-    getc(FOO) eq "a" or die "foo->GETC failed";
-    printf "%s is number %d\n", "Perl", 1;
-}
-EXPECT
-This is a reversed sentence.
--- Out of inspiration --
-foo->can(READ)(string 10 1)
-Don't GETC, Get Perl
-Perl is number 1
-and destroyed as well
-########
-my @a; $a[2] = 1; for (@a) { $_ = 2 } print "@a\n"
-EXPECT
-2 2 2
-########
-# used to attach defelem magic to all immortal values,
-# which made restore of local $_ fail.
-foo(2>1);
-sub foo { bar() for @_;  }
-sub bar { local $_; }
-print "ok\n";
-EXPECT
-ok
-########
-@a = ($a, $b, $c, $d) = (5, 6);
-print "ok\n"
-  if ($a[0] == 5 and $a[1] == 6 and !defined $a[2] and !defined $a[3]);
-EXPECT
-ok
-########
-print "ok\n" if (1E2<<1 == 200 and 3E4<<3 == 240000);
-EXPECT
-ok
-########
-print "ok\n" if ("\0" lt "\xFF");
-EXPECT
-ok
-########
-open(H,'op/misc.t'); # must be in the 't' directory
-stat(H);
-print "ok\n" if (-e _ and -f _ and -r _);
-EXPECT
-ok
-########
-sub thing { 0 || return qw(now is the time) }
-print thing(), "\n";
-EXPECT
-nowisthetime
-########
-$ren = 'joy';
-$stimpy = 'happy';
-{ local $main::{ren} = *stimpy; print $ren, ' ' }
-print $ren, "\n";
-EXPECT
-happy joy
-########
-$stimpy = 'happy';
-{ local $main::{ren} = *stimpy; print ${'ren'}, ' ' }
-print +(defined(${'ren'}) ? 'oops' : 'joy'), "\n";
-EXPECT
-happy joy
-########
-package p;
-sub func { print 'really ' unless wantarray; 'p' }
-sub groovy { 'groovy' }
-package main;
-print p::func()->groovy(), "\n"
-EXPECT
-really groovy
-########
-@list = ([ 'one', 1 ], [ 'two', 2 ]);
-sub func { $num = shift; (grep $_->[1] == $num, @list)[0] }
-print scalar(map &func($_), 1 .. 3), " ",
-      scalar(map scalar &func($_), 1 .. 3), "\n";
-EXPECT
-2 3
-########
-($k, $s)  = qw(x 0);
-@{$h{$k}} = qw(1 2 4);
-for (@{$h{$k}}) { $s += $_; delete $h{$k} if ($_ == 2) }
-print "bogus\n" unless $s == 7;
-########
-my $a = 'outer';
-eval q[ my $a = 'inner'; eval q[ print "$a " ] ];
-eval { my $x = 'peace'; eval q[ print "$x\n" ] }
-EXPECT
-inner peace
-########
--w
-$| = 1;
-sub foo {
-    print "In foo1\n";
-    eval 'sub foo { print "In foo2\n" }';
-    print "Exiting foo1\n";
-}
-foo;
-foo;
-EXPECT
-In foo1
-Subroutine foo redefined at (eval 1) line 1.
-Exiting foo1
-In foo2
-########
-$s = 0;
-map {#this newline here tickles the bug
-$s += $_} (1,2,4);
-print "eat flaming death\n" unless ($s == 7);
-########
-sub foo { local $_ = shift; split; @_ }
-@x = foo(' x  y  z ');
-print "you die joe!\n" unless "@x" eq 'x y z';
-########
-/(?{"{"})/	# Check it outside of eval too
-EXPECT
-Sequence (?{...}) not terminated or not {}-balanced at - line 1, within pattern
-Sequence (?{...}) not terminated or not {}-balanced in regex; marked by <-- HERE in m/(?{ <-- HERE "{"})/ at - line 1.
-########
-/(?{"{"}})/	# Check it outside of eval too
-EXPECT
-Unmatched right curly bracket at (re_eval 1) line 1, at end of line
-syntax error at (re_eval 1) line 1, near ""{"}"
-Compilation failed in regexp at - line 1.
-########
-BEGIN { @ARGV = qw(a b c d e) }
-BEGIN { print "argv <@ARGV>\nbegin <",shift,">\n" }
-END { print "end <",shift,">\nargv <@ARGV>\n" }
-INIT { print "init <",shift,">\n" }
-CHECK { print "check <",shift,">\n" }
-EXPECT
-argv <a b c d e>
-begin <a>
-check <b>
-init <c>
-end <d>
-argv <e>
-########
--l
-# fdopen from a system descriptor to a system descriptor used to close
-# the former.
-open STDERR, '>&=STDOUT' or die $!;
-select STDOUT; $| = 1; print fileno STDOUT or die $!;
-select STDERR; $| = 1; print fileno STDERR or die $!;
-EXPECT
-1
-2
-########
--w
-sub testme { my $a = "test"; { local $a = "new test"; print $a }}
-EXPECT
-Can't localize lexical variable $a at - line 2.
-########
-package X;
-sub ascalar { my $r; bless \$r }
-sub DESTROY { print "destroyed\n" };
-package main;
-*s = ascalar X;
-EXPECT
-destroyed
-########
-package X;
-sub anarray { bless [] }
-sub DESTROY { print "destroyed\n" };
-package main;
-*a = anarray X;
-EXPECT
-destroyed
-########
-package X;
-sub ahash { bless {} }
-sub DESTROY { print "destroyed\n" };
-package main;
-*h = ahash X;
-EXPECT
-destroyed
-########
-package X;
-sub aclosure { my $x; bless sub { ++$x } }
-sub DESTROY { print "destroyed\n" };
-package main;
-*c = aclosure X;
-EXPECT
-destroyed
-########
-package X;
-sub any { bless {} }
-my $f = "FH000"; # just to thwart any future optimisations
-sub afh { select select ++$f; my $r = *{$f}{IO}; delete $X::{$f}; bless $r }
-sub DESTROY { print "destroyed\n" }
-package main;
-$x = any X; # to bump sv_objcount. IO objs aren't counted??
-*f = afh X;
-EXPECT
-destroyed
-destroyed
-########
-BEGIN {
-  $| = 1;
-  $SIG{__WARN__} = sub {
-    eval { print $_[0] };
-    die "bar\n";
-  };
-  warn "foo\n";
-}
-EXPECT
-foo
-bar
-BEGIN failed--compilation aborted at - line 8.
-########
-package X;
-@ISA='Y';
-sub new {
-    my $class = shift;
-    my $self = { };
-    bless $self, $class;
-    my $init = shift;
-    $self->foo($init);
-    print "new", $init;
-    return $self;
-}
-sub DESTROY {
-    my $self = shift;
-    print "DESTROY", $self->foo;
-}
-package Y;
-sub attribute {
-    my $self = shift;
-    my $var = shift;
-    if (@_ == 0) {
-	return $self->{$var};
-    } elsif (@_ == 1) {
-	$self->{$var} = shift;
-    }
-}
-sub AUTOLOAD {
-    $AUTOLOAD =~ /::([^:]+)$/;
-    my $method = $1;
-    splice @_, 1, 0, $method;
-    goto &attribute;
-}
-package main;
-my $x = X->new(1);
-for (2..3) {
-    my $y = X->new($_);
-    print $y->foo;
-}
-print $x->foo;
-EXPECT
-new1new22DESTROY2new33DESTROY31DESTROY1
-########
-re();
-sub re {
-    my $re = join '', eval 'qr/(??{ $obj->method })/';
-    $re;
-}
-EXPECT
-########
-use strict;
-my $foo = "ZZZ\n";
-END { print $foo }
-EXPECT
-ZZZ
-########
-eval '
-use strict;
-my $foo = "ZZZ\n";
-END { print $foo }
-';
-EXPECT
-ZZZ
-########
--w
-if (@ARGV) { print "" }
-else {
-  if ($x == 0) { print "" } else { print $x }
-}
-EXPECT
-Use of uninitialized value in numeric eq (==) at - line 4.
-########
-$x = sub {};
-foo();
-sub foo { eval { return }; }
-print "ok\n";
-EXPECT
-ok
-########
-# moved to op/lc.t
-EXPECT
-########
-sub f { my $a = 1; my $b = 2; my $c = 3; my $d = 4; next }
-my $x = "foo";
-{ f } continue { print $x, "\n" }
-EXPECT
-foo
-########
-sub C () { 1 }
-sub M { $_[0] = 2; }
-eval "C";
-M(C);
-EXPECT
-Modification of a read-only value attempted at - line 2.
-########
-print qw(ab a\b a\\b);
-EXPECT
-aba\ba\b
-########
-# lexicals declared after the myeval() definition should not be visible
-# within it
-sub myeval { eval $_[0] }
-my $foo = "ok 2\n";
-myeval('sub foo { local $foo = "ok 1\n"; print $foo; }');
-die $@ if $@;
-foo();
-print $foo;
-EXPECT
-ok 1
-ok 2
-########
-# lexicals outside an eval"" should be visible inside subroutine definitions
-# within it
-eval <<'EOT'; die $@ if $@;
-{
-    my $X = "ok\n";
-    eval 'sub Y { print $X }'; die $@ if $@;
-    Y();
-}
-EOT
-EXPECT
-ok
-########
-# test that closures generated by eval"" hold on to the CV of the eval""
-# for their entire lifetime
-$code = eval q[
-  sub { eval '$x = "ok 1\n"'; }
-];
-&{$code}();
-print $x;
-EXPECT
-ok 1
-########
-# This test is here instead of pragma/locale.t because
-# the bug depends on in the internal state of the locale
-# settings and pragma/locale messes up that state pretty badly.
-# We need a "fresh run".
-BEGIN {
-    eval { require POSIX };
-    if ($@) {
-	exit(0); # running minitest?
-    }
-}
-use Config;
-my $have_setlocale = $Config{d_setlocale} eq 'define';
-$have_setlocale = 0 if $@;
-# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
-# and mingw32 uses said silly CRT
-$have_setlocale = 0 if (($^O eq 'MSWin32' || $^O eq 'NetWare') && $Config{cc} =~ /^(cl|gcc)/i);
-exit(0) unless $have_setlocale;
-my @locales;
-if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a|")) {
-    while(<LOCALES>) {
-        chomp;
-        push(@locales, $_);
-    }
-    close(LOCALES);
-}
-exit(0) unless @locales;
-for (@locales) {
-    use POSIX qw(locale_h);
-    use locale;
-    setlocale(LC_NUMERIC, $_) or next;
-    my $s = sprintf "%g %g", 3.1, 3.1;
-    next if $s eq '3.1 3.1' || $s =~ /^(3.+1) \1$/;
-    print "$_ $s\n";
-}
-EXPECT
-########
-die qr(x)
-EXPECT
-(?-xism:x) at - line 1.
-########
-# 20001210.003 mjd@plover.com
-format REMITOUT_TOP =
-FOO
-.
-
-format REMITOUT =
-BAR
-.
-
-# This loop causes a segv in 5.6.0
-for $lineno (1..61) {
-   write REMITOUT;
-}
-
-print "It's OK!";
-EXPECT
-It's OK!
-########
-# Inaba Hiroto
-reset;
-if (0) {
-  if ("" =~ //) {
-  }
-}
-########
-# Nicholas Clark
-$ENV{TERM} = 0;
-reset;
-// if 0;
-########
-# Vadim Konovalov
-use strict;
-sub new_pmop($) {
-    my $pm = shift;
-    return eval "sub {shift=~/$pm/}";
-}
-new_pmop "abcdef"; reset;
-new_pmop "abcdef"; reset;
-new_pmop "abcdef"; reset;
-new_pmop "abcdef"; reset;
-########
-# David Dyck
-# coredump in 5.7.1
-close STDERR; die;
-EXPECT
-########
--w
-"x" =~ /(\G?x)?/;	# core dump in 20000716.007
-EXPECT
-Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in m/(\G?x)? <-- HERE / at - line 2.
-########
-# Bug 20010515.004
-my @h = 1 .. 10;
-bad(@h);
-sub bad {
-   undef @h;
-   print "O";
-   print for @_;
-   print "K";
-}
-EXPECT
-OK
-########
-# Bug 20010506.041
-"abcd\x{1234}" =~ /(a)(b[c])(d+)?/i and print "ok\n";
-EXPECT
-ok
-########
-# Bug 20010422.005
-{s//${}/; //}
-EXPECT
-syntax error at - line 2, near "${}"
-Execution of - aborted due to compilation errors.
-########
-# Bug 20010528.007
-"\x{"
-EXPECT
-Missing right brace on \x{} at - line 2, within string
-Execution of - aborted due to compilation errors.
-########
-my $foo = Bar->new();
-my @dst;
-END {
-    ($_ = "@dst") =~ s/\(0x.+?\)/(0x...)/;
-    print $_, "\n";
-}
-package Bar;
-sub new {
-    my Bar $self = bless [], Bar;
-    eval '$self';
-    return $self;
-}
-sub DESTROY { 
-    push @dst, "$_[0]";
-}
-EXPECT
-Bar=ARRAY(0x...)
-########
-# 20010407.008 sprintf removes utf8-ness
-$a = sprintf "\x{1234}";
-printf "%x %d\n", unpack("U*", $a), length($a);
-$a = sprintf "%s", "\x{5678}";
-printf "%x %d\n", unpack("U*", $a), length($a);
-$a = sprintf "\x{1234}%s", "\x{5678}";
-printf "%x %x %d\n", unpack("U*", $a), length($a);
-EXPECT
-1234 1
-5678 1
-1234 5678 2
-########
-# keep this last - doesn't seem to work otherwise?
-eval "a.b.c.d.e.f;sub"
-EXPECT
diff --git a/t/run/kill_perl.t b/t/run/kill_perl.t
new file mode 100644
index 0000000000..2b4a5a6e93
--- /dev/null
+++ b/t/run/kill_perl.t
@@ -0,0 +1,791 @@
+#!./perl
+
+# This is for tests that will normally cause segfaults, and other nasty
+# errors that might kill the interpreter and for some reason you can't
+# use an eval().
+#
+# New tests are added to the bottom.  For example.
+#
+#       ######## perlbug ID 20020831.001
+#       ($a, b) = (1,2)
+#       EXPECT
+#       Can't modify constant item in list assignment - at line 1
+#
+# to test that the code "($a, b) = (1,2)" causes the appropriate syntax
+# error, rather than just segfaulting as reported in perlbug ID
+# 20020831.001
+#
+#
+# NOTE: Please don't add tests to this file unless they *need* to be
+# run in separate executable and can't simply use eval.
+
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+}
+
+use strict;
+
+$|=1;
+
+my @prgs = ();
+while(<DATA>) { 
+    if(m/^#{8,}\s*(.*)/) { 
+        push @prgs, ['', $1];
+    }
+    else { 
+        $prgs[-1][0] .= $_;
+    }
+}
+print "1..", scalar @prgs, "\n";
+
+my $tmpfile = "misctmp000";
+1 while -f ++$tmpfile;
+END { while($tmpfile && unlink $tmpfile){} }
+
+my $test = 1;
+foreach my $prog (@prgs) {
+    my($raw_prog, $name) = @$prog;
+
+    my $switch;
+    if ($raw_prog =~ s/^\s*(-\w.*)//){
+	$switch = $1;
+    }
+
+    my($prog,$expected) = split(/\nEXPECT\n/, $raw_prog);
+
+    open TEST, ">$tmpfile" or die "Cannot open $tmpfile: $!";
+
+    # VMS adjustments
+    if( $^O eq 'VMS' ) {
+        $prog =~ s#/dev/null#NL:#;
+
+        # VMS file locking 
+        $prog =~ s{if \(-e _ and -f _ and -r _\)}
+                  {if (-e _ and -f _)}
+    }
+
+    print TEST $prog, "\n";
+    close TEST or die "Cannot close $tmpfile: $!";
+
+    my $results;
+    if ($^O eq 'MSWin32') {
+        $results = `.\\perl -I../lib $switch $tmpfile 2>&1`;
+    }
+    elsif ($^O eq 'NetWare') {
+        $results = `perl -I../lib $switch $tmpfile 2>&1`;
+    }
+    else {
+      $results = `./perl -I../lib $switch $tmpfile 2>&1`;
+    }
+    my $status = $?;
+
+    # Clean up the results into something a bit more predictable.
+    $results =~ s/\n+$//;
+    $results =~ s/at\s+misctmp\d+\s+line/at - line/g;
+    $results =~ s/of\s+misctmp\d+\s+aborted/of - aborted/g;
+
+    # bison says 'parse error' instead of 'syntax error',
+    # various yaccs may or may not capitalize 'syntax'.
+    $results =~ s/^(syntax|parse) error/syntax error/mig;
+
+    $results =~ s/\n\n/\n/ if $^O eq 'VMS'; # pipes double these sometimes
+
+    $expected =~ s/\n+$//;
+    my $ok = $results eq $expected;
+
+    unless( $ok ) {
+        print STDERR "# PROG: $switch\n$prog\n";
+        print STDERR "# EXPECTED:\n$expected\n";
+        print STDERR "# GOT:\n$results\n";
+    }
+    printf "%sok %d%s\n", ($ok ? '' : "not "), $test, 
+                          length $name ? " - $name" : $name;
+    $test++;
+}
+
+__END__
+########
+$a = ":="; split /($a)/o, "a:=b:=c"; print "@_"
+EXPECT
+a := b := c
+########
+$cusp = ~0 ^ (~0 >> 1);
+use integer;
+$, = " ";
+print +($cusp - 1) % 8, $cusp % 8, -$cusp % 8, 8 | (($cusp + 1) % 8 + 7), "!\n";
+EXPECT
+7 0 0 8 !
+########
+$foo=undef; $foo->go;
+EXPECT
+Can't call method "go" on an undefined value at - line 1.
+########
+BEGIN
+        {
+	    "foo";
+        }
+########
+$array[128]=1
+########
+$x=0x0eabcd; print $x->ref;
+EXPECT
+Can't call method "ref" without a package or object reference at - line 1.
+########
+chop ($str .= <DATA>);
+########
+close ($banana);
+########
+$x=2;$y=3;$x<$y ? $x : $y += 23;print $x;
+EXPECT
+25
+########
+eval {sub bar {print "In bar";}}
+########
+system './perl -ne "print if eof" /dev/null'
+########
+chop($file = <DATA>);
+########
+package N;
+sub new {my ($obj,$n)=@_; bless \$n}  
+$aa=new N 1;
+$aa=12345;
+print $aa;
+EXPECT
+12345
+########
+%@x=0;
+EXPECT
+Can't modify hash dereference in repeat (x) at - line 1, near "0;"
+Execution of - aborted due to compilation errors.
+########
+$_="foo";
+printf(STDOUT "%s\n", $_);
+EXPECT
+foo
+########
+push(@a, 1, 2, 3,)
+########
+quotemeta ""
+########
+for ("ABCDE") {
+ &sub;
+s/./&sub($&)/eg;
+print;}
+sub sub {local($_) = @_;
+$_ x 4;}
+EXPECT
+Modification of a read-only value attempted at - line 3.
+########
+package FOO;sub new {bless {FOO => BAR}};
+package main;
+use strict vars;   
+my $self = new FOO;
+print $$self{FOO};
+EXPECT
+BAR
+########
+$_="foo";
+s/.{1}//s;
+print;
+EXPECT
+oo
+########
+print scalar ("foo","bar")
+EXPECT
+bar
+########
+sub by_number { $a <=> $b; };# inline function for sort below
+$as_ary{0}="a0";
+@ordered_array=sort by_number keys(%as_ary);
+########
+sub NewShell
+{
+  local($Host) = @_;
+  my($m2) = $#Shells++;
+  $Shells[$m2]{HOST} = $Host;
+  return $m2;
+}
+ 
+sub ShowShell
+{
+  local($i) = @_;
+}
+ 
+&ShowShell(&NewShell(beach,Work,"+0+0"));
+&ShowShell(&NewShell(beach,Work,"+0+0"));
+&ShowShell(&NewShell(beach,Work,"+0+0"));
+########
+   {
+       package FAKEARRAY;
+   
+       sub TIEARRAY
+       { print "TIEARRAY @_\n"; 
+         die "bomb out\n" unless $count ++ ;
+         bless ['foo'] 
+       }
+       sub FETCH { print "fetch @_\n"; $_[0]->[$_[1]] }
+       sub STORE { print "store @_\n"; $_[0]->[$_[1]] = $_[2] }
+       sub DESTROY { print "DESTROY \n"; undef @{$_[0]}; }
+   }
+   
+eval 'tie @h, FAKEARRAY, fred' ;
+tie @h, FAKEARRAY, fred ;
+EXPECT
+TIEARRAY FAKEARRAY fred
+TIEARRAY FAKEARRAY fred
+DESTROY 
+########
+BEGIN { die "phooey\n" }
+EXPECT
+phooey
+BEGIN failed--compilation aborted at - line 1.
+########
+BEGIN { 1/$zero }
+EXPECT
+Illegal division by zero at - line 1.
+BEGIN failed--compilation aborted at - line 1.
+########
+BEGIN { undef = 0 }
+EXPECT
+Modification of a read-only value attempted at - line 1.
+BEGIN failed--compilation aborted at - line 1.
+########
+{
+    package foo;
+    sub PRINT {
+        shift;
+        print join(' ', reverse @_)."\n";
+    }
+    sub PRINTF {
+        shift;
+	  my $fmt = shift;
+        print sprintf($fmt, @_)."\n";
+    }
+    sub TIEHANDLE {
+        bless {}, shift;
+    }
+    sub READLINE {
+	"Out of inspiration";
+    }
+    sub DESTROY {
+	print "and destroyed as well\n";
+  }
+  sub READ {
+      shift;
+      print STDOUT "foo->can(READ)(@_)\n";
+      return 100; 
+  }
+  sub GETC {
+      shift;
+      print STDOUT "Don't GETC, Get Perl\n";
+      return "a"; 
+  }    
+}
+{
+    local(*FOO);
+    tie(*FOO,'foo');
+    print FOO "sentence.", "reversed", "a", "is", "This";
+    print "-- ", <FOO>, " --\n";
+    my($buf,$len,$offset);
+    $buf = "string";
+    $len = 10; $offset = 1;
+    read(FOO, $buf, $len, $offset) == 100 or die "foo->READ failed";
+    getc(FOO) eq "a" or die "foo->GETC failed";
+    printf "%s is number %d\n", "Perl", 1;
+}
+EXPECT
+This is a reversed sentence.
+-- Out of inspiration --
+foo->can(READ)(string 10 1)
+Don't GETC, Get Perl
+Perl is number 1
+and destroyed as well
+########
+my @a; $a[2] = 1; for (@a) { $_ = 2 } print "@a\n"
+EXPECT
+2 2 2
+########
+# used to attach defelem magic to all immortal values,
+# which made restore of local $_ fail.
+foo(2>1);
+sub foo { bar() for @_;  }
+sub bar { local $_; }
+print "ok\n";
+EXPECT
+ok
+########
+@a = ($a, $b, $c, $d) = (5, 6);
+print "ok\n"
+  if ($a[0] == 5 and $a[1] == 6 and !defined $a[2] and !defined $a[3]);
+EXPECT
+ok
+########
+print "ok\n" if (1E2<<1 == 200 and 3E4<<3 == 240000);
+EXPECT
+ok
+########
+print "ok\n" if ("\0" lt "\xFF");
+EXPECT
+ok
+########
+open(H,'op/misc.t'); # must be in the 't' directory
+stat(H);
+print "ok\n" if (-e _ and -f _ and -r _);
+EXPECT
+ok
+########
+sub thing { 0 || return qw(now is the time) }
+print thing(), "\n";
+EXPECT
+nowisthetime
+########
+$ren = 'joy';
+$stimpy = 'happy';
+{ local $main::{ren} = *stimpy; print $ren, ' ' }
+print $ren, "\n";
+EXPECT
+happy joy
+########
+$stimpy = 'happy';
+{ local $main::{ren} = *stimpy; print ${'ren'}, ' ' }
+print +(defined(${'ren'}) ? 'oops' : 'joy'), "\n";
+EXPECT
+happy joy
+########
+package p;
+sub func { print 'really ' unless wantarray; 'p' }
+sub groovy { 'groovy' }
+package main;
+print p::func()->groovy(), "\n"
+EXPECT
+really groovy
+########
+@list = ([ 'one', 1 ], [ 'two', 2 ]);
+sub func { $num = shift; (grep $_->[1] == $num, @list)[0] }
+print scalar(map &func($_), 1 .. 3), " ",
+      scalar(map scalar &func($_), 1 .. 3), "\n";
+EXPECT
+2 3
+########
+($k, $s)  = qw(x 0);
+@{$h{$k}} = qw(1 2 4);
+for (@{$h{$k}}) { $s += $_; delete $h{$k} if ($_ == 2) }
+print "bogus\n" unless $s == 7;
+########
+my $a = 'outer';
+eval q[ my $a = 'inner'; eval q[ print "$a " ] ];
+eval { my $x = 'peace'; eval q[ print "$x\n" ] }
+EXPECT
+inner peace
+########
+-w
+$| = 1;
+sub foo {
+    print "In foo1\n";
+    eval 'sub foo { print "In foo2\n" }';
+    print "Exiting foo1\n";
+}
+foo;
+foo;
+EXPECT
+In foo1
+Subroutine foo redefined at (eval 1) line 1.
+Exiting foo1
+In foo2
+########
+$s = 0;
+map {#this newline here tickles the bug
+$s += $_} (1,2,4);
+print "eat flaming death\n" unless ($s == 7);
+########
+sub foo { local $_ = shift; split; @_ }
+@x = foo(' x  y  z ');
+print "you die joe!\n" unless "@x" eq 'x y z';
+########
+/(?{"{"})/	# Check it outside of eval too
+EXPECT
+Sequence (?{...}) not terminated or not {}-balanced at - line 1, within pattern
+Sequence (?{...}) not terminated or not {}-balanced in regex; marked by <-- HERE in m/(?{ <-- HERE "{"})/ at - line 1.
+########
+/(?{"{"}})/	# Check it outside of eval too
+EXPECT
+Unmatched right curly bracket at (re_eval 1) line 1, at end of line
+syntax error at (re_eval 1) line 1, near ""{"}"
+Compilation failed in regexp at - line 1.
+########
+BEGIN { @ARGV = qw(a b c d e) }
+BEGIN { print "argv <@ARGV>\nbegin <",shift,">\n" }
+END { print "end <",shift,">\nargv <@ARGV>\n" }
+INIT { print "init <",shift,">\n" }
+CHECK { print "check <",shift,">\n" }
+EXPECT
+argv <a b c d e>
+begin <a>
+check <b>
+init <c>
+end <d>
+argv <e>
+########
+-l
+# fdopen from a system descriptor to a system descriptor used to close
+# the former.
+open STDERR, '>&=STDOUT' or die $!;
+select STDOUT; $| = 1; print fileno STDOUT or die $!;
+select STDERR; $| = 1; print fileno STDERR or die $!;
+EXPECT
+1
+2
+########
+-w
+sub testme { my $a = "test"; { local $a = "new test"; print $a }}
+EXPECT
+Can't localize lexical variable $a at - line 2.
+########
+package X;
+sub ascalar { my $r; bless \$r }
+sub DESTROY { print "destroyed\n" };
+package main;
+*s = ascalar X;
+EXPECT
+destroyed
+########
+package X;
+sub anarray { bless [] }
+sub DESTROY { print "destroyed\n" };
+package main;
+*a = anarray X;
+EXPECT
+destroyed
+########
+package X;
+sub ahash { bless {} }
+sub DESTROY { print "destroyed\n" };
+package main;
+*h = ahash X;
+EXPECT
+destroyed
+########
+package X;
+sub aclosure { my $x; bless sub { ++$x } }
+sub DESTROY { print "destroyed\n" };
+package main;
+*c = aclosure X;
+EXPECT
+destroyed
+########
+package X;
+sub any { bless {} }
+my $f = "FH000"; # just to thwart any future optimisations
+sub afh { select select ++$f; my $r = *{$f}{IO}; delete $X::{$f}; bless $r }
+sub DESTROY { print "destroyed\n" }
+package main;
+$x = any X; # to bump sv_objcount. IO objs aren't counted??
+*f = afh X;
+EXPECT
+destroyed
+destroyed
+########
+BEGIN {
+  $| = 1;
+  $SIG{__WARN__} = sub {
+    eval { print $_[0] };
+    die "bar\n";
+  };
+  warn "foo\n";
+}
+EXPECT
+foo
+bar
+BEGIN failed--compilation aborted at - line 8.
+########
+package X;
+@ISA='Y';
+sub new {
+    my $class = shift;
+    my $self = { };
+    bless $self, $class;
+    my $init = shift;
+    $self->foo($init);
+    print "new", $init;
+    return $self;
+}
+sub DESTROY {
+    my $self = shift;
+    print "DESTROY", $self->foo;
+}
+package Y;
+sub attribute {
+    my $self = shift;
+    my $var = shift;
+    if (@_ == 0) {
+	return $self->{$var};
+    } elsif (@_ == 1) {
+	$self->{$var} = shift;
+    }
+}
+sub AUTOLOAD {
+    $AUTOLOAD =~ /::([^:]+)$/;
+    my $method = $1;
+    splice @_, 1, 0, $method;
+    goto &attribute;
+}
+package main;
+my $x = X->new(1);
+for (2..3) {
+    my $y = X->new($_);
+    print $y->foo;
+}
+print $x->foo;
+EXPECT
+new1new22DESTROY2new33DESTROY31DESTROY1
+########
+re();
+sub re {
+    my $re = join '', eval 'qr/(??{ $obj->method })/';
+    $re;
+}
+EXPECT
+########
+use strict;
+my $foo = "ZZZ\n";
+END { print $foo }
+EXPECT
+ZZZ
+########
+eval '
+use strict;
+my $foo = "ZZZ\n";
+END { print $foo }
+';
+EXPECT
+ZZZ
+########
+-w
+if (@ARGV) { print "" }
+else {
+  if ($x == 0) { print "" } else { print $x }
+}
+EXPECT
+Use of uninitialized value in numeric eq (==) at - line 4.
+########
+$x = sub {};
+foo();
+sub foo { eval { return }; }
+print "ok\n";
+EXPECT
+ok
+########
+# moved to op/lc.t
+EXPECT
+########
+sub f { my $a = 1; my $b = 2; my $c = 3; my $d = 4; next }
+my $x = "foo";
+{ f } continue { print $x, "\n" }
+EXPECT
+foo
+########
+sub C () { 1 }
+sub M { $_[0] = 2; }
+eval "C";
+M(C);
+EXPECT
+Modification of a read-only value attempted at - line 2.
+########
+print qw(ab a\b a\\b);
+EXPECT
+aba\ba\b
+########
+# lexicals declared after the myeval() definition should not be visible
+# within it
+sub myeval { eval $_[0] }
+my $foo = "ok 2\n";
+myeval('sub foo { local $foo = "ok 1\n"; print $foo; }');
+die $@ if $@;
+foo();
+print $foo;
+EXPECT
+ok 1
+ok 2
+########
+# lexicals outside an eval"" should be visible inside subroutine definitions
+# within it
+eval <<'EOT'; die $@ if $@;
+{
+    my $X = "ok\n";
+    eval 'sub Y { print $X }'; die $@ if $@;
+    Y();
+}
+EOT
+EXPECT
+ok
+########
+# test that closures generated by eval"" hold on to the CV of the eval""
+# for their entire lifetime
+$code = eval q[
+  sub { eval '$x = "ok 1\n"'; }
+];
+&{$code}();
+print $x;
+EXPECT
+ok 1
+########
+# This test is here instead of pragma/locale.t because
+# the bug depends on in the internal state of the locale
+# settings and pragma/locale messes up that state pretty badly.
+# We need a "fresh run".
+BEGIN {
+    eval { require POSIX };
+    if ($@) {
+	exit(0); # running minitest?
+    }
+}
+use Config;
+my $have_setlocale = $Config{d_setlocale} eq 'define';
+$have_setlocale = 0 if $@;
+# Visual C's CRT goes silly on strings of the form "en_US.ISO8859-1"
+# and mingw32 uses said silly CRT
+$have_setlocale = 0 if (($^O eq 'MSWin32' || $^O eq 'NetWare') && $Config{cc} =~ /^(cl|gcc)/i);
+exit(0) unless $have_setlocale;
+my @locales;
+if (-x "/usr/bin/locale" && open(LOCALES, "/usr/bin/locale -a|")) {
+    while(<LOCALES>) {
+        chomp;
+        push(@locales, $_);
+    }
+    close(LOCALES);
+}
+exit(0) unless @locales;
+for (@locales) {
+    use POSIX qw(locale_h);
+    use locale;
+    setlocale(LC_NUMERIC, $_) or next;
+    my $s = sprintf "%g %g", 3.1, 3.1;
+    next if $s eq '3.1 3.1' || $s =~ /^(3.+1) \1$/;
+    print "$_ $s\n";
+}
+EXPECT
+########
+die qr(x)
+EXPECT
+(?-xism:x) at - line 1.
+########
+# 20001210.003 mjd@plover.com
+format REMITOUT_TOP =
+FOO
+.
+
+format REMITOUT =
+BAR
+.
+
+# This loop causes a segv in 5.6.0
+for $lineno (1..61) {
+   write REMITOUT;
+}
+
+print "It's OK!";
+EXPECT
+It's OK!
+########
+# Inaba Hiroto
+reset;
+if (0) {
+  if ("" =~ //) {
+  }
+}
+########
+# Nicholas Clark
+$ENV{TERM} = 0;
+reset;
+// if 0;
+########
+# Vadim Konovalov
+use strict;
+sub new_pmop($) {
+    my $pm = shift;
+    return eval "sub {shift=~/$pm/}";
+}
+new_pmop "abcdef"; reset;
+new_pmop "abcdef"; reset;
+new_pmop "abcdef"; reset;
+new_pmop "abcdef"; reset;
+########
+# David Dyck
+# coredump in 5.7.1
+close STDERR; die;
+EXPECT
+########
+-w
+"x" =~ /(\G?x)?/;	# core dump in 20000716.007
+EXPECT
+Quantifier unexpected on zero-length expression in regex; marked by <-- HERE in m/(\G?x)? <-- HERE / at - line 2.
+########
+# Bug 20010515.004
+my @h = 1 .. 10;
+bad(@h);
+sub bad {
+   undef @h;
+   print "O";
+   print for @_;
+   print "K";
+}
+EXPECT
+OK
+########
+# Bug 20010506.041
+"abcd\x{1234}" =~ /(a)(b[c])(d+)?/i and print "ok\n";
+EXPECT
+ok
+########
+# Bug 20010422.005
+{s//${}/; //}
+EXPECT
+syntax error at - line 2, near "${}"
+Execution of - aborted due to compilation errors.
+########
+# Bug 20010528.007
+"\x{"
+EXPECT
+Missing right brace on \x{} at - line 2, within string
+Execution of - aborted due to compilation errors.
+########
+my $foo = Bar->new();
+my @dst;
+END {
+    ($_ = "@dst") =~ s/\(0x.+?\)/(0x...)/;
+    print $_, "\n";
+}
+package Bar;
+sub new {
+    my Bar $self = bless [], Bar;
+    eval '$self';
+    return $self;
+}
+sub DESTROY { 
+    push @dst, "$_[0]";
+}
+EXPECT
+Bar=ARRAY(0x...)
+########
+# 20010407.008 sprintf removes utf8-ness
+$a = sprintf "\x{1234}";
+printf "%x %d\n", unpack("U*", $a), length($a);
+$a = sprintf "%s", "\x{5678}";
+printf "%x %d\n", unpack("U*", $a), length($a);
+$a = sprintf "\x{1234}%s", "\x{5678}";
+printf "%x %x %d\n", unpack("U*", $a), length($a);
+EXPECT
+1234 1
+5678 1
+1234 5678 2
+########
+# keep this last - doesn't seem to work otherwise?
+eval "a.b.c.d.e.f;sub"
+EXPECT
+
+######## perlbug ID 20010831.001
+($a, b) = (1, 2);
+EXPECT
+Can't modify constant item in list assignment at - line 1, near ");"
+Execution of - aborted due to compilation errors.
diff --git a/t/run/segfault.t b/t/run/segfault.t
deleted file mode 100644
index e3bd8b64be..0000000000
--- a/t/run/segfault.t
+++ /dev/null
@@ -1,43 +0,0 @@
-#!./perl
-#
-# Tests for things which have caused segfaults in the past.
-
-BEGIN {
-    chdir 't' if -d 't';
-    @INC = '../lib';
-}
-
-# VMS and Windows need -e "...", most everything else works better with '
-my $quote = $^O =~ /^(VMS|MSWin\d+)$/ ? q{"} : q{'};
-
-my $IsVMS = $^O eq 'VMS';
-
-
-BEGIN {
-   if( $^O =~ /^(VMS|MSWin\d+)$/ ) {
-      print "1..0 # Skipped: platform temporarily not supported\n";
-      exit;
-   }
-}
-
-
-# Run some code, check that it has the expected output and exits
-# with the code for a perl syntax error.
-sub chk_segfault {
-    my($code, $expect, $name) = @_;
-    my $cmd = "$^X -e ";
-
-    # I *think* these are the right exit codes for syntax error.
-    my $expected_exit = $IsVMS ? 4 : 255;
-
-    my $out = `$cmd$quote$code$quote 2>&1`;
-
-    is( $? >> 8,    $expected_exit,     "$name - exit as expected" );
-    like( $out, qr/$expect at -e line 1/, '  with the right output' );
-}
-
-use Test::More tests => 2;
-
-chk_segfault('($a, b) = (1, 2)',  
-             "Can't modify constant item in list assignment",
-             'perlbug ID 20010831.001');
-- 
cgit v1.2.1


From 9731f9ce05d1c7e58d4cec595b6014e465a43d2d Mon Sep 17 00:00:00 2001
From: Artur Bergman <sky@nanisky.com>
Date: Sun, 2 Sep 2001 12:10:42 +0000
Subject: Change #11828 wasn't complete, this updates to intest path

p4raw-id: //depot/perl@11831
---
 t/run/kill_perl.t | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 't')

diff --git a/t/run/kill_perl.t b/t/run/kill_perl.t
index 2b4a5a6e93..a48a49bfa9 100644
--- a/t/run/kill_perl.t
+++ b/t/run/kill_perl.t
@@ -329,7 +329,7 @@ print "ok\n" if ("\0" lt "\xFF");
 EXPECT
 ok
 ########
-open(H,'op/misc.t'); # must be in the 't' directory
+open(H,'run/kill_perl.t'); # must be in the 't' directory
 stat(H);
 print "ok\n" if (-e _ and -f _ and -r _);
 EXPECT
-- 
cgit v1.2.1


From 7c8c5f1c6bacd8af44376dc42a0005978f87c8dd Mon Sep 17 00:00:00 2001
From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Sun, 2 Sep 2001 12:59:05 +0000
Subject: Slight tweaks.

p4raw-id: //depot/perl@11833
---
 t/run/kill_perl.t | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 't')

diff --git a/t/run/kill_perl.t b/t/run/kill_perl.t
index a48a49bfa9..aa7a4a9d45 100644
--- a/t/run/kill_perl.t
+++ b/t/run/kill_perl.t
@@ -779,8 +779,7 @@ EXPECT
 1234 1
 5678 1
 1234 5678 2
-########
-# keep this last - doesn't seem to work otherwise?
+######## found by Markov chain stress testing
 eval "a.b.c.d.e.f;sub"
 EXPECT
 
-- 
cgit v1.2.1