diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-05 04:51:05 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-05 04:51:05 +0000 |
commit | d50d6d396ae47d78a9d8d07a754868f35492d7fc (patch) | |
tree | 0413a0edd9c375c5c962f846d8c7cabef3082141 /test/ruby/test_beginendblock.rb | |
parent | d77b17aa73110c289c354316bb9c600f53bb3684 (diff) |
* test/ruby/test_beginendblock.rb, test/ruby/beginmainend.rb: add tests about
scope, order and allowd syntax.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_beginendblock.rb')
-rw-r--r-- | test/ruby/test_beginendblock.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 301d2c62f5..06b1519189 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -7,6 +7,18 @@ class TestBeginEndBlock < Test::Unit::TestCase def test_beginendblock ruby = EnvUtil.rubybin io = IO.popen("\"#{ruby}\" \"#{DIR}/beginmainend.rb\"") - assert_equal("begin\nmain\nend\n", io.read) + assert_equal(%w(begin1 begin2 main end1 end2).join("\n") << "\n", io.read) + end + + def test_begininmethod + assert_raises(SyntaxError) do + eval("def foo; BEGIN {}; end") + end + end + + def test_endinmethod + assert_raises(SyntaxError) do + eval("def foo; END {}; end") + end end end |