aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/endblockwarn.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-07 06:27:11 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-07 06:27:11 +0000
commitcd8d08b5329fd86660cced8a5b91c4a042f2e2a0 (patch)
tree9be66a2d0ca34f17a0c52b1616bffa570a28264a /test/ruby/endblockwarn.rb
parent0a5f6fd37d7b83dd78adfbaecb050fd3cc4fb3e9 (diff)
downloadruby-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/endblockwarn.rb')
-rw-r--r--test/ruby/endblockwarn.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/endblockwarn.rb b/test/ruby/endblockwarn.rb
new file mode 100644
index 0000000000..8da5c241ee
--- /dev/null
+++ b/test/ruby/endblockwarn.rb
@@ -0,0 +1,26 @@
+BEGIN {
+ if errout = ARGV.shift
+ dir = File.dirname(File.expand_path(__FILE__))
+ basename = File.basename(__FILE__)
+ require "#{dir}/envutil"
+ STDERR.reopen(File.open(errout, "w"))
+ STDERR.sync = true
+ Dir.chdir(dir)
+ cmd = "\"#{EnvUtil.rubybin}\" \"#{basename}\""
+ exec(cmd)
+ exit!("must not reach here")
+ end
+}
+
+def end1
+ END {}
+end
+
+end1
+
+eval <<EOE
+ def end2
+ END {}
+ end
+EOE
+