path: root/test/-ext-
diff options
authorJeremy Evans <>2019-09-29 21:33:59 -0700
committerJeremy Evans <>2019-09-30 07:06:42 -0700
commit3073404e741df19ae16248126640777ed36110e8 (patch)
tree3e47a5336c27487329f43205746b17b3f03e5276 /test/-ext-
parent5ddc2ba13ed6964a0383894e3728dc1bc708c404 (diff)
Add rb_enumeratorize_with_size_kw and related macros
Currently, there is not a way to create a sized enumerator in C with a different set of arguments than provided by Ruby, and correctly handle keyword arguments. This function allows that. The need for this is fairly uncommon, but it occurs at least in Enumerator.produce, which takes arugments from Ruby but calls rb_enumeratorize_with_size with a different set of arguments.
Notes: Merged:
Diffstat (limited to 'test/-ext-')
1 files changed, 11 insertions, 0 deletions
diff --git a/test/-ext-/test_enumerator_kw.rb b/test/-ext-/test_enumerator_kw.rb
new file mode 100644
index 0000000000..fb47c2bcf8
--- /dev/null
+++ b/test/-ext-/test_enumerator_kw.rb
@@ -0,0 +1,11 @@
+require 'test/unit'
+require '-test-/enumerator_kw'
+class TestEnumeratorKw < Test::Unit::TestCase
+ def test_enumerator_kw
+ o =
+ o.extend Bug::EnumeratorKw
+ assert_equal([nil, [], {:a=>1}, o], o.m(a: 1) { |*a| a })
+ assert_equal([nil, [[], {:a=>1}, o], nil, o], o.m(a: 1).each { |*a| a })
+ end