diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-12 13:43:56 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-12-12 13:43:56 +0000 |
commit | 900b4a6db63012d9ce32a1019a7c9d5b014a0047 (patch) | |
tree | 0ecc0563750b343b1ce214634be5ab98a146db5b /test/ruby | |
parent | cc006d368c64ec3fdf51280f93b23155d95e1884 (diff) | |
download | ruby-900b4a6db63012d9ce32a1019a7c9d5b014a0047.tar.gz |
* parse.y (stmt_or_begin): changed the error message for BEGIN not
at toplevel. [ruby-dev:44963] [Bug #5738]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_beginendblock.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 7e460b989d..18649ffbd4 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -33,19 +33,22 @@ class TestBeginEndBlock < Test::Unit::TestCase end def test_begininmethod - assert_raise(SyntaxError) do + e = assert_raise(SyntaxError) do eval("def foo; BEGIN {}; end") end + assert_match(/BEGIN is permitted only at toplevel/, e.message) - assert_raise(SyntaxError) do + e = assert_raise(SyntaxError) do eval('eval("def foo; BEGIN {}; end")') end + assert_match(/BEGIN is permitted only at toplevel/, e.message) end def test_begininclass - assert_raise(SyntaxError) do + e = assert_raise(SyntaxError) do eval("class TestBeginEndBlock; BEGIN {}; end") end + assert_match(/BEGIN is permitted only at toplevel/, e.message) end def test_endblockwarn |