summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authoryui-knk <spiketeika@gmail.com>2024-12-23 13:58:25 +0900
committerYuichiro Kaneko <spiketeika@gmail.com>2024-12-23 14:53:51 +0900
commit18580bc4e0296dac77d583c037f6346441773e02 (patch)
tree9a17ca100db24c7fd2aff43774a6ce568e611195 /test/ruby
parentbd569cb7081e11628ee637ce9364d56c653c932c (diff)
Add a test case for nested block `it`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12435
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_syntax.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb
index edf5886a53..a226b10d94 100644
--- a/test/ruby/test_syntax.rb
+++ b/test/ruby/test_syntax.rb
@@ -1920,6 +1920,7 @@ eom
assert_equal(4, eval('a=Object.new; def a.foo(it); it; end; a.foo(4)'))
assert_equal(5, eval('a=Object.new; def a.it; 5; end; a.it'))
assert_equal(6, eval('a=Class.new; a.class_eval{ def it; 6; end }; a.new.it'))
+ assert_equal([7, 8], eval('a=[]; [7].each { a << it; [8].each { a << it } }; a'))
assert_raise_with_message(NameError, /undefined local variable or method 'it'/) do
eval('it')
end