Up till now, eval"" in list context was returning a list containing
undef for syntax errors and an empty list for run-time errors.
sv_setpvs(ERRSV, "Compilation error");
}
}
- PUSHs(&PL_sv_undef);
+ if (gimme != G_ARRAY) PUSHs(&PL_sv_undef);
PUTBACK;
return FALSE;
}
return;
}
-sub is {
+sub is($$$) {
my ($got, $expect, $name) = @_;
$test = $test + 1;
if (defined $expect) {
require './test.pl';
}
-plan(tests => 121);
+plan(tests => 125);
eval 'pass();';
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;