Sha256: 8d945d88351dd9ab61f4cce16b1ec16e2d56f4ecde64c44d7cd662f31721918c

Contents?: true

Size: 713 Bytes

Versions: 3

Compression:

Stored size: 713 Bytes

Contents

require "spec_helper"
require "hamster/list"

describe Hamster::List do
  describe "#drop" do
    it "is lazy" do
      -> { Hamster.stream { fail }.drop(1) }.should_not raise_error
    end

    [
      [[], 10, []],
      [["A"], 10, []],
      [["A"], -1, ["A"]],
      [%w[A B C], 0, %w[A B C]],
      [%w[A B C], 2, ["C"]],
    ].each do |values, number, expected|
      context "with #{number} from #{values.inspect}" do
        let(:list) { L[*values] }

        it "preserves the original" do
          list.drop(number)
          list.should eql(L[*values])
        end

        it "returns #{expected.inspect}" do
          list.drop(number).should == L[*expected]
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/hamster-3.0.0/spec/lib/hamster/list/drop_spec.rb
hamster-3.0.0 spec/lib/hamster/list/drop_spec.rb
hamster-2.0.0 spec/lib/hamster/list/drop_spec.rb