diff options
author | Alan Wu <[email protected]> | 2025-01-14 12:08:35 -0500 |
---|---|---|
committer | Alan Wu <[email protected]> | 2025-01-14 12:09:22 -0500 |
commit | 1adcd960e2c0ef7e5debafa4245cd14420616d7b (patch) | |
tree | 8c77381380657e9b8755875dc25acabff9007eb5 | |
parent | 2bcbc80fa26795145584af2a1cb322ac7b46f13e (diff) |
Add tests for Proc#parameters on `it` blocks
[Bug #20955]
-rw-r--r-- | test/ruby/test_proc.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 3c3d83a144..acacea9362 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1391,6 +1391,8 @@ class TestProc < Test::Unit::TestCase pr = eval("proc{|"+"(_),"*30+"|}") assert_empty(pr.parameters.map{|_,n|n}.compact) + + assert_equal([[:opt]], proc { it }.parameters) end def test_proc_autosplat_with_multiple_args_with_ruby2_keywords_splat_bug_19759 @@ -1439,6 +1441,9 @@ class TestProc < Test::Unit::TestCase assert_equal([[:opt, :a]], lambda {|a|}.parameters(lambda: false)) assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], lambda {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters(lambda: false)) + + assert_equal([[:req]], proc { it }.parameters(lambda: true)) + assert_equal([[:opt]], lambda { it }.parameters(lambda: false)) end def pm0() end |