HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/src/ruby-2.7.4/spec/ruby/core/enumerator/lazy/flat_map_spec.rb
# -*- encoding: us-ascii -*-

require_relative '../../../spec_helper'
require_relative 'shared/collect_concat'

describe "Enumerator::Lazy#flat_map" do
  it_behaves_like :enumerator_lazy_collect_concat, :flat_map

  it "properly unwraps nested yields" do
    s = Enumerator.new do |y| loop do y << [1, 2] end end

    expected = s.take(3).flat_map { |x| x }.to_a
    actual = s.lazy.take(3).flat_map{ |x| x }.force
    actual.should == expected
  end
end