diff options
author | Akinori MUSHA <[email protected]> | 2022-12-16 13:32:13 +0900 |
---|---|---|
committer | Akinori MUSHA <[email protected]> | 2022-12-16 13:32:13 +0900 |
commit | ad18d1297ed82aa9c38375532b0b709131cf1ae7 (patch) | |
tree | e3ac410ffc7963c82ff19eca08b6538064539b1b /test/ruby/test_enumerator.rb | |
parent | 29cb767a1c1ea5d3726ce969cb02f7305f4b1476 (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.rb | 8 |
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 |