summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-11-19 11:13:24 -0800
committerFather Chrysostomos <sprout@cpan.org>2011-12-06 08:42:05 -0800
commit2bf54cc6effa09e0b0bb5bf18c7a215f8d75a200 (patch)
tree282a6040e511b7aa337cbc1e74cd9d4c474adfb8 /t
parentbbde7ba366f7e8eba62f86287e5267085c03d7dc (diff)
downloadperl-2bf54cc6effa09e0b0bb5bf18c7a215f8d75a200.tar.gz
[perl #80630] Make eval"" return empty list for syntax errors
Up till now, eval"" in list context was returning a list containing undef for syntax errors and an empty list for run-time errors.
Diffstat (limited to 't')
-rw-r--r--t/comp/retainedlines.t2
-rw-r--r--t/op/eval.t7
2 files changed, 7 insertions, 2 deletions
diff --git a/t/comp/retainedlines.t b/t/comp/retainedlines.t
index 25687bed9e..01557a659b 100644
--- a/t/comp/retainedlines.t
+++ b/t/comp/retainedlines.t
@@ -24,7 +24,7 @@ sub failed {
return;
}
-sub is {
+sub is($$$) {
my ($got, $expect, $name) = @_;
$test = $test + 1;
if (defined $expect) {
diff --git a/t/op/eval.t b/t/op/eval.t
index 78faa8545c..5cd7f4c125 100644
--- a/t/op/eval.t
+++ b/t/op/eval.t
@@ -6,7 +6,7 @@ BEGIN {
require './test.pl';
}
-plan(tests => 121);
+plan(tests => 125);
eval 'pass();';
@@ -25,6 +25,11 @@ like($@, qr/line 2/);
print eval '$foo = /'; # this tests for a call through fatal()
like($@, qr/Search/);
+is scalar(eval '++'), undef, 'eval syntax error in scalar context';
+is scalar(eval 'die'), undef, 'eval run-time error in scalar context';
+is +()=eval '++', 0, 'eval syntax error in list context';
+is +()=eval 'die', 0, 'eval run-time error in list context';
+
is(eval '"ok 7\n";', "ok 7\n");
$foo = 5;