summaryrefslogtreecommitdiff
path: root/t/op/eval.t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-11 18:40:49 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-11 18:40:49 +0000
commitb45de488d87a3fe293c21579bc4d11fe89c10fb3 (patch)
tree6ffdf145ec9243aea5139911d8eb987db4697353 /t/op/eval.t
parent1d76a5c36fe33e7755afd0f03faf19826beda303 (diff)
downloadperl-b45de488d87a3fe293c21579bc4d11fe89c10fb3.tar.gz
another long-standing eval bug: return doesn't reset $@ correctly
p4raw-id: //depot/perl@5660
Diffstat (limited to 't/op/eval.t')
-rwxr-xr-xt/op/eval.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/t/op/eval.t b/t/op/eval.t
index ea6caf43bd..183892389f 100755
--- a/t/op/eval.t
+++ b/t/op/eval.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..38\n";
+print "1..40\n";
eval 'print "ok 1\n";';
@@ -182,3 +182,27 @@ print $@;
print $c eq '2222222222' ? "ok $x\n" : "# $c\nnot ok $x\n";
$x++;
}
+
+# return from eval {} should clear $@ correctly
+{
+ my $status = eval {
+ eval { die };
+ print "# eval { return } test\n";
+ return; # removing this changes behavior
+ };
+ print "not " if $@;
+ print "ok $x\n";
+ $x++;
+}
+
+# ditto for eval ""
+{
+ my $status = eval q{
+ eval q{ die };
+ print "# eval q{ return } test\n";
+ return; # removing this changes behavior
+ };
+ print "not " if $@;
+ print "ok $x\n";
+ $x++;
+}