summaryrefslogtreecommitdiffstats
path: root/test/ruby/beginmainend.rb
diff options
context:
space:
mode:
authornahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-05 04:51:05 +0000
committernahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-05 04:51:05 +0000
commita415b799f52f07d318abc0489fad28e304620a90 (patch)
tree0413a0edd9c375c5c962f846d8c7cabef3082141 /test/ruby/beginmainend.rb
parent8fb85a996458874bfbd864d3e55cc1e69749cbc6 (diff)
downloadruby-a415b799f52f07d318abc0489fad28e304620a90.tar.gz
ruby-a415b799f52f07d318abc0489fad28e304620a90.tar.xz
ruby-a415b799f52f07d318abc0489fad28e304620a90.zip
* test/ruby/test_beginendblock.rb, test/ruby/beginmainend.rb: add tests about
scope, order and allowd syntax. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4692 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/beginmainend.rb')
-rw-r--r--test/ruby/beginmainend.rb32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/ruby/beginmainend.rb b/test/ruby/beginmainend.rb
index 4ee1d7899..f89c09207 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
}