mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
d50d6d396a
scope, order and allowd syntax. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
24 lines
599 B
Ruby
24 lines
599 B
Ruby
require 'test/unit'
|
|
require "#{File.dirname(File.expand_path(__FILE__))}/envutil"
|
|
|
|
class TestBeginEndBlock < Test::Unit::TestCase
|
|
DIR = File.dirname(File.expand_path(__FILE__))
|
|
|
|
def test_beginendblock
|
|
ruby = EnvUtil.rubybin
|
|
io = IO.popen("\"#{ruby}\" \"#{DIR}/beginmainend.rb\"")
|
|
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
|