summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorNAKAMURA Usaku <usa@ruby-lang.org>2021-11-24 19:38:18 +0900
committerNAKAMURA Usaku <usa@ruby-lang.org>2021-11-24 19:38:18 +0900
commitb1985629565c3c54b1a64d6faf213e8144857515 (patch)
tree1ee86b30895b440285bcd1a4a536552d2773d13c /test/ruby
parent1d4e037a8011ac05b4ede8cdf8263515ba0e095e (diff)
merge revision(s) e83c02a768af61cd0890a75e90bcae1119d8bd93: [Backport #18289]
Delegate keywords from Enumerable#to_a to #each Fixes [Bug #18289] --- enum.c | 2 +- test/ruby/test_enum.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_enum.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_enum.rb b/test/ruby/test_enum.rb
index ebb7e78381..9f6f19b669 100644
--- a/test/ruby/test_enum.rb
+++ b/test/ruby/test_enum.rb
@@ -114,6 +114,11 @@ class TestEnumerable < Test::Unit::TestCase
assert_equal([1, 2, 3, 1, 2], @obj.to_a)
end
+ def test_to_a_keywords
+ def @obj.each(foo:) yield foo end
+ assert_equal([1], @obj.to_a(foo: 1))
+ end
+
def test_to_a_size_symbol
sym = Object.new
class << sym