aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/beginmainend.rb
diff options
context:
space:
mode:
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 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
}