Add SyntaxError test and don't print compilation error to stderr in eval.

This commit is contained in:
take_cheeze
2014-07-09 22:03:21 +09:00
committed by Yukihiro "Matz" Matsumoto
parent d1eea450bf
commit c6ce43303d
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -112,6 +112,7 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha
if (file) {
mrbc_filename(mrb, cxt, file);
}
cxt->capture_errors = TRUE;
p = mrb_parse_nstring(mrb, s, len, cxt);
+6
View File
@@ -44,3 +44,9 @@ assert('rest arguments of eval') do
Kernel.eval('[\'test\', __FILE__, __LINE__]', nil, 'test.rb', 10)
end
end
assert 'eval syntax error' do
assert_raise(SyntaxError) do
eval 'p "test'
end
end