Skip to content

Commit 684ac67

Browse files
eneboandrykonchin
authored andcommitted
Add spec for capture/non-capture for it in blocks
1 parent 9d29895 commit 684ac67

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

language/block_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1069,3 +1069,11 @@ def all_kwrest(arg1, arg2, *rest, post1, post2, kw1: 1, kw2: 2, okw1:, okw2:, **
10691069
end
10701070
end
10711071
end
1072+
1073+
describe "`it` is a captured variable in a block if `it` is outside" do
1074+
ruby_version_is "3.3"..."3.4" do
1075+
proc { it }.call(0).should eq(0)
1076+
it = 5
1077+
proc { it }.call(0).should eq(5)
1078+
end
1079+
end

0 commit comments

Comments
 (0)