summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2025-01-10 12:24:39 -0500
committerAlan Wu <XrXr@users.noreply.github.com>2025-01-13 12:58:59 -0500
commit6637aa4682ef64134e05af949a9beee260dab937 (patch)
treebe0f88d070815ec8530ff58e4b4b532690f1232f /test
parent85a25116ccfe509d8a3de9cd5bfc467f2d77159e (diff)
Proc#parameters: Show anonymous optionals as `[:opt]`
Have this for lead parameters as well as parameters after rest ("post"). [Bug #20974]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12547
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_proc.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 966144c199..3c3d83a144 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -1382,7 +1382,8 @@ class TestProc < Test::Unit::TestCase
assert_equal([[:opt, :a], [:rest, :b], [:opt, :c]], proc {|a, *b, c|}.parameters)
assert_equal([[:opt, :a], [:rest, :b], [:opt, :c], [:block, :d]], proc {|a, *b, c, &d|}.parameters)
assert_equal([[:opt, :a], [:opt, :b], [:rest, :c], [:opt, :d], [:block, :e]], proc {|a, b=:b, *c, d, &e|}.parameters)
- assert_equal([[:opt, nil], [:block, :b]], proc {|(a), &b|a}.parameters)
+ assert_equal([[:opt], [:block, :b]], proc {|(a), &b|a}.parameters)
+ assert_equal([[:opt], [:rest, :_], [:opt]], proc {|(a_), *_, (b_)|}.parameters)
assert_equal([[:opt, :a], [:opt, :b], [:opt, :c], [:opt, :d], [:rest, :e], [:opt, :f], [:opt, :g], [:block, :h]], proc {|a,b,c=:c,d=:d,*e,f,g,&h|}.parameters)
assert_equal([[:req]], method(:putc).parameters)