Commit c6ce4330 authored by take_cheeze's avatar take_cheeze Committed by Yukihiro "Matz" Matsumoto

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

parent d1eea450
...@@ -112,6 +112,7 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha ...@@ -112,6 +112,7 @@ create_proc_from_string(mrb_state *mrb, char *s, int len, mrb_value binding, cha
if (file) { if (file) {
mrbc_filename(mrb, cxt, file); mrbc_filename(mrb, cxt, file);
} }
cxt->capture_errors = TRUE;
p = mrb_parse_nstring(mrb, s, len, cxt); p = mrb_parse_nstring(mrb, s, len, cxt);
......
...@@ -44,3 +44,9 @@ assert('rest arguments of eval') do ...@@ -44,3 +44,9 @@ assert('rest arguments of eval') do
Kernel.eval('[\'test\', __FILE__, __LINE__]', nil, 'test.rb', 10) Kernel.eval('[\'test\', __FILE__, __LINE__]', nil, 'test.rb', 10)
end end
end end
assert 'eval syntax error' do
assert_raise(SyntaxError) do
eval 'p "test'
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment