diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-18 16:43:29 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-18 16:43:29 +0000 |
commit | 6b438bee0447e723f27835ded85df80c4c43d5a5 (patch) | |
tree | 6d6b28e9971a24670cc447d971ba1abc8dea93be /test | |
parent | f00951bb25c5a2a1508a7ff6e09a299700030f0a (diff) | |
download | ruby-6b438bee0447e723f27835ded85df80c4c43d5a5.tar.gz |
* 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/trunk@26347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_beginendblock.rb | 6 |
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. |