diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-28 06:13:00 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-28 06:13:00 +0000 |
commit | c566af8f6e7583c6a6c2eed336abb9999661e44d (patch) | |
tree | 49d56a1f3efdb05a84cfec55141b7882aef816dc /test | |
parent | 42b9397bd3fb92299c92fa8e9d491867de6f0c56 (diff) | |
download | ruby-c566af8f6e7583c6a6c2eed336abb9999661e44d.tar.gz |
parse.y: fix token
* parse.y (parser_parse_string): return proper token tREGEXP_END
at unterminated regexp. [Bug #13363]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_parse.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index a604d3b193..d6850f4bfd 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -1022,6 +1022,14 @@ x = __ENCODING__ assert_operator(line, :end_with?, "...\n") end + def test_unterminated_regexp_error + e = assert_raise(SyntaxError) do + eval("/x") + end.message + assert_match(/unterminated regexp meets end of file/, e) + assert_not_match(/unexpected tSTRING_END/, e) + end + =begin def test_past_scope_variable assert_warning(/past scope/) {catch {|tag| eval("BEGIN{throw tag}; tap {a = 1}; a")}} |