Skip to content

Commit

Permalink
Add SyntaxError test and don't print compilation error to stderr in…
Browse files Browse the repository at this point in the history
… eval.
  • Loading branch information
take-cheeze authored and matz committed Jul 12, 2014
1 parent d1eea45 commit c6ce433
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions mrbgems/mruby-eval/src/eval.c
Expand Up @@ -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);

Expand Down
6 changes: 6 additions & 0 deletions mrbgems/mruby-eval/test/eval.rb
Expand Up @@ -44,3 +44,9 @@
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

0 comments on commit c6ce433

Please sign in to comment.