From 2d0062bcf5081fadbda999ffe45468782fda7fa2 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 28 Mar 2018 04:49:41 +0000 Subject: merge revision(s) 61346: [Backport #14206] parse.y: end of script at newline * parse.y (parser_yylex): deal with end of script chars just after ignored newline as other places. [ruby-core:84349] [Bug #14206] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_parse.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_parse.rb b/test/ruby/test_parse.rb index f48928b85e..0b608c4a16 100644 --- a/test/ruby/test_parse.rb +++ b/test/ruby/test_parse.rb @@ -899,6 +899,12 @@ x = __ENCODING__ assert_equal(line, obj.location.lineno, bug) end + def test_eof_in_def + assert_raise(SyntaxError) { eval("def m\n\0""end") } + assert_raise(SyntaxError) { eval("def m\n\C-d""end") } + assert_raise(SyntaxError) { eval("def m\n\C-z""end") } + 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