diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-07 06:27:11 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-10-07 06:27:11 +0000 |
commit | cd8d08b5329fd86660cced8a5b91c4a042f2e2a0 (patch) | |
tree | 9be66a2d0ca34f17a0c52b1616bffa570a28264a /test/ruby/beginmainend.rb | |
parent | 0a5f6fd37d7b83dd78adfbaecb050fd3cc4fb3e9 (diff) | |
download | ruby-cd8d08b5329fd86660cced8a5b91c4a042f2e2a0.tar.gz |
* test/ruby/test_beginendblock.rb: add tests for nested BEGIN/END.
* test/ruby/beginmainend.rb: add tests for nested BEGIN/END.
* test/ruby/endblockwarn.rb: new file added to test of END-in-method warning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/beginmainend.rb')
-rw-r--r-- | test/ruby/beginmainend.rb | 50 |
1 files changed, 40 insertions, 10 deletions
diff --git a/test/ruby/beginmainend.rb b/test/ruby/beginmainend.rb index 4710a7aeb1..f096b96fbc 100644 --- a/test/ruby/beginmainend.rb +++ b/test/ruby/beginmainend.rb @@ -1,25 +1,31 @@ +errout = ARGV.shift + BEGIN { - puts "begin1" + puts "b1" local_begin1 = "local_begin1" $global_begin1 = "global_begin1" ConstBegin1 = "ConstBegin1" } BEGIN { - puts "begin2" + puts "b2" + + BEGIN { + puts "b2-1" + } } # 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" +local_for_end2 = "e2" +$global_for_end1 = "e1" puts "main" END { - puts local_for_end2 + puts local_for_end2 # e2 } END { @@ -29,27 +35,51 @@ END { eval <<EOE BEGIN { - puts "innerbegin1" + puts "b3" + + BEGIN { + puts "b3-1" + } } BEGIN { - puts "innerbegin2" + puts "b4" } END { - puts "innerend2" + puts "e3" } END { - puts "innerend1" + puts "e4" + + END { + puts "e4-1" + + END { + puts "e4-1-1" + } + } + + END { + puts "e4-2" + } } EOE END { exit puts "should not be dumped" + + END { + puts "not reached" + } } END { - puts $global_for_end1 + puts $global_for_end1 # e1 + + END { + puts "e1-1" + } } |