diff options
Diffstat (limited to 'test/ruby/test_lazy_enumerator.rb')
-rw-r--r-- | test/ruby/test_lazy_enumerator.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test/ruby/test_lazy_enumerator.rb b/test/ruby/test_lazy_enumerator.rb index 792a95bb7e..e6888583f9 100644 --- a/test/ruby/test_lazy_enumerator.rb +++ b/test/ruby/test_lazy_enumerator.rb @@ -14,7 +14,14 @@ class TestLazyEnumerator < Test::Unit::TestCase def each(*args) @args = args - @enum.each {|i| @current = i; yield i} + @enum.each do |v| + @current = v + if v.is_a? Enumerable + yield *v + else + yield v + end + end end end @@ -100,6 +107,15 @@ class TestLazyEnumerator < Test::Unit::TestCase assert_equal(1, a.current) end + def test_map_packed_nested + bug = '[ruby-core:81638] [Bug#13648]' + + a = Step.new([[1, 2]]) + expected = [[[1, 2]]] + assert_equal(expected, a.map {|*args| args}.map {|*args| args}.to_a) + assert_equal(expected, a.lazy.map {|*args| args}.map {|*args| args}.to_a, bug) + end + def test_flat_map a = Step.new(1..3) assert_equal(2, a.flat_map {|x| [x * 2]}.first) |