summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-29 16:51:19 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-29 16:51:19 +0000
commit7c6feec335827d3e4da1eea89e639fa417158a0a (patch)
tree10540fe55f07c1120f3fbf9c744d47fc418e4e85 /test
parent0d836d908d15a7f66ab72d44ad264ff721731101 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@21876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_beginendblock.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb
index 463ebd94b6..4cfcbb01de 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.