From cd8d08b5329fd86660cced8a5b91c4a042f2e2a0 Mon Sep 17 00:00:00 2001 From: nahi Date: Tue, 7 Oct 2003 06:27:11 +0000 Subject: * 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 --- test/ruby/beginmainend.rb | 50 ++++++++++++++++++++++++++++++++--------- test/ruby/endblockwarn.rb | 26 +++++++++++++++++++++ test/ruby/test_beginendblock.rb | 48 +++++++++++++++++++++++++++++++-------- test/ruby/test_float.rb | 5 +++++ 4 files changed, 110 insertions(+), 19 deletions(-) create mode 100644 test/ruby/endblockwarn.rb (limited to 'test/ruby') 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 <