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/beginmainend.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/beginmainend.rb')
-rw-r--r-- | test/ruby/beginmainend.rb | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/ruby/beginmainend.rb b/test/ruby/beginmainend.rb index 4ee1d7899a..f89c09207e 100644 --- a/test/ruby/beginmainend.rb +++ b/test/ruby/beginmainend.rb @@ -1,9 +1,37 @@ BEGIN { - puts "begin" + puts "begin1" + local_begin1 = "local_begin1" + $global_begin1 = "global_begin1" + ConstBegin1 = "ConstBegin1" } +BEGIN { + puts "begin2" +} + +# for scope check +raise if defined?(local_begin1) +raise unless defined?($global_begin1) +raise unless defined?(::ConstBegin1) +local_for_end2 = "end2" +$global_for_end1 = "end1" + puts "main" END { - puts "end" + puts local_for_end2 +} + +END { + raise + puts "should not be dumped" +} + +END { + exit + puts "should not be dumped" +} + +END { + puts $global_for_end1 } |