diff options
| author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-29 16:51:19 +0000 |
|---|---|---|
| committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-29 16:51:19 +0000 |
| commit | dfac43ab652a279879400d848610e63b91124560 (patch) | |
| tree | 10540fe55f07c1120f3fbf9c744d47fc418e4e85 /test/ruby/test_beginendblock.rb | |
| parent | 889c7ff0eb295ab20766ec9580d652be13b42357 (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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_beginendblock.rb')
| -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 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. |
