diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | parse.y | 2 | ||||
-rw-r--r-- | test/ruby/test_parse.rb | 5 |
3 files changed, 11 insertions, 2 deletions
@@ -1,3 +1,9 @@ +Fri Aug 8 01:07:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * parse.y (parser_yylex): fix invalid char in eval, should raise + an syntax error too, as well as directly coded. + [ruby-core:64243] [Bug #10117] + Thu Aug 7 23:25:29 2014 Masaki Matsushita <glass.saga@gmail.com> * lib/open3.rb: avoid unnecessary write if stdin_data is empty. @@ -8266,7 +8266,7 @@ parser_yylex(struct parser_params *parser) default: if (!parser_is_identchar()) { - rb_compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c); + compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c); goto retry; } diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index 8f957bbc58..008dbbcd92 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -657,8 +657,11 @@ x = __ENCODING__ end def test_invalid_char + bug10117 = '[ruby-core:64243] [Bug #10117]' + invalid_char = /Invalid char `\\x01'/ x = 1 - assert_equal(1, eval("\x01x")) + assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117) + assert_syntax_error("\x01x", invalid_char, bug10117) assert_equal(nil, eval("\x04x")) end |