diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-19 11:13:24 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-12-06 08:42:05 -0800 |
commit | 2bf54cc6effa09e0b0bb5bf18c7a215f8d75a200 (patch) | |
tree | 282a6040e511b7aa337cbc1e74cd9d4c474adfb8 /t/op | |
parent | bbde7ba366f7e8eba62f86287e5267085c03d7dc (diff) | |
download | perl-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/op')
-rw-r--r-- | t/op/eval.t | 7 |
1 files changed, 6 insertions, 1 deletions
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; |