summaryrefslogtreecommitdiff
path: root/spec/ruby/language
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-01-17 10:08:06 +0900
committerNobuyoshi Nakada <[email protected]>2023-01-24 16:36:33 +0900
commit5a73e131d7458b3ede3d0f5a4447989a43ee915b (patch)
treeaa72942ccdb37f4a209447920f8ede7be35a3b4b /spec/ruby/language
parent98081ac7cce12adac5b9fcadfba372498e118097 (diff)
Add tests for variables in `END` block shared with the toplevel
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7136
Diffstat (limited to 'spec/ruby/language')
-rw-r--r--spec/ruby/language/END_spec.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/spec/ruby/language/END_spec.rb b/spec/ruby/language/END_spec.rb
index 762a8db0c0..787f602d88 100644
--- a/spec/ruby/language/END_spec.rb
+++ b/spec/ruby/language/END_spec.rb
@@ -12,4 +12,8 @@ describe "The END keyword" do
it "runs multiple ends in LIFO order" do
ruby_exe("END { puts 'foo' }; END { puts 'bar' }").should == "bar\nfoo\n"
end
+
+ it "is affected by the toplevel assignment" do
+ ruby_exe("foo = 'foo'; END { puts foo }").should == "foo\n"
+ end
end