From dfac43ab652a279879400d848610e63b91124560 Mon Sep 17 00:00:00 2001 From: mame Date: Thu, 29 Jan 2009 16:51:19 +0000 Subject: * parse.y (top_compstmt, top_stmts, top_stmt): prohibit BEGIN {} in non-toplevel scope. [ruby-core:21657] * test/ruby/test_beginendblock.rb (test_begininclass): add a test for above. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_beginendblock.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/ruby/test_beginendblock.rb') diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 463ebd94b..4cfcbb01d 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -41,6 +41,12 @@ class TestBeginEndBlock < Test::Unit::TestCase end end + def test_begininclass + assert_raise(SyntaxError) do + eval("class TestBeginEndBlock; BEGIN {}; end") + end + end + def test_endblockwarn ruby = EnvUtil.rubybin # Use Tempfile to create temporary file path. -- cgit