summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2002-12-17 10:08:24 +0000
committerhv <hv@crypt.org>2002-12-17 10:08:24 +0000
commit7e736055d1d6da7ec885d3dacef1bcc5e5ef4282 (patch)
tree512e1ccb8bafb07529e153260f2ea8d250eb3bad /t/op
parent18755edac90087d08b49876214aa686ee7a95263 (diff)
downloadperl-7e736055d1d6da7ec885d3dacef1bcc5e5ef4282.tar.gz
Whoops, these are the changes supposed to be in #18318.
p4raw-id: //depot/perl@18319
Diffstat (limited to 't/op')
-rwxr-xr-xt/op/eval.t48
1 files changed, 46 insertions, 2 deletions
diff --git a/t/op/eval.t b/t/op/eval.t
index e81b9f76a5..8e8f69c0b8 100755
--- a/t/op/eval.t
+++ b/t/op/eval.t
@@ -1,6 +1,11 @@
#!./perl
-print "1..84\n";
+BEGIN {
+ chdir 't' if -d 't';
+ @INC = '../lib';
+}
+
+print "1..87\n";
eval 'print "ok 1\n";';
@@ -346,7 +351,8 @@ eval q{ my $yyy = 888; my $zzz = 999; fred5(); };
{
$eval = eval 'sub { eval "sub { %S }" }';
$eval->({});
- print "ok 78\n";
+ print "ok $test\n";
+ $test++;
}
# evals that appear in the DB package should see the lexical scope of the
@@ -375,3 +381,41 @@ our $x = 1;
print DB::db5() == 3 ? 'ok' : 'not ok', " $test\n"; $test++;
print db6() == 4 ? 'ok' : 'not ok', " $test\n"; $test++;
}
+require './test.pl';
+$NO_ENDING = 1;
+# [perl #19022] used to end up with shared hash warnings
+# The program should generate no output, so anything we see is on stderr
+my $got = runperl (prog => '$h{a}=1; foreach my $k (keys %h) {eval qq{\$k}}',
+ stderr => 1);
+
+if ($got eq '') {
+ print "ok $test\n";
+} else {
+ print "not ok $test\n";
+ _diag ("# Got '$got'\n");
+}
+$test++;
+
+# And a buggy way of fixing #19022 made this fail - $k became undef after the
+# eval for a build with copy on write
+{
+ my %h;
+ $h{a}=1;
+ foreach my $k (keys %h) {
+ if (defined $k and $k eq 'a') {
+ print "ok $test\n";
+ } else {
+ print "not $test # got ", _q ($k), "\n";
+ }
+ $test++;
+
+ eval "\$k";
+
+ if (defined $k and $k eq 'a') {
+ print "ok $test\n";
+ } else {
+ print "not $test # got ", _q ($k), "\n";
+ }
+ $test++;
+ }
+}