From f78d92c5cafbf4e5292df025eaf290070f4367d7 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 28 Jun 2017 06:13:00 +0000 Subject: 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 --- test/ruby/test_parse.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'test') 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")}} -- cgit v1.2.3