mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
f00951bb25
commit
6b438bee04
3 changed files with 83 additions and 20 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue