summaryrefslogtreecommitdiff
path: root/test/ruby/test_enumerator.rb
diff options
context:
space:
mode:
authorAkinori MUSHA <[email protected]>2022-12-16 13:32:13 +0900
committerAkinori MUSHA <[email protected]>2022-12-16 13:32:13 +0900
commitad18d1297ed82aa9c38375532b0b709131cf1ae7 (patch)
treee3ac410ffc7963c82ff19eca08b6538064539b1b /test/ruby/test_enumerator.rb
parent29cb767a1c1ea5d3726ce969cb02f7305f4b1476 (diff)
Reject keyword arguments given to Enumerator::Product.new
The use of keyword arguments should be reserved for future extension.
Diffstat (limited to 'test/ruby/test_enumerator.rb')
-rw-r--r--test/ruby/test_enumerator.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_enumerator.rb b/test/ruby/test_enumerator.rb
index 3ca33126d5..d448d62bd5 100644
--- a/test/ruby/test_enumerator.rb
+++ b/test/ruby/test_enumerator.rb
@@ -924,6 +924,10 @@ class TestEnumerator < Test::Unit::TestCase
e.each { |*x| elts << x }
assert_equal [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]], elts
+ assert_raise(ArgumentError) {
+ Enumerator::Product.new(1..3, foo: 1, bar: 2)
+ }
+
e = Enumerator.product(1..3, %w[a b])
assert_instance_of(Enumerator::Product, e)
@@ -943,5 +947,9 @@ class TestEnumerator < Test::Unit::TestCase
e = Enumerator.product(1..3, Enumerator.new { |y| y << 'a' << 'b' })
assert_equal(nil, e.size)
assert_equal [[1, "a"], [1, "b"], [2, "a"], [2, "b"]], e.take(4)
+
+ assert_raise(ArgumentError) {
+ Enumerator.product(1..3, foo: 1, bar: 2)
+ }
end
end