Sha256: 991e861b0e739cf3bd32c05204dab89e942134d408c74f001be2ae70ad81ee16

Contents?: true

Size: 908 Bytes

Versions: 1

Compression:

Stored size: 908 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

require 'hamster/list'

describe Hamster::List do

  describe "#to_ary" do

    describe "doesn't run out of stack space on a really big" do

      before do
        @interval = Hamster.interval(0, 10000)
      end

      it "stream" do
        @list = @interval
      end

      it "list" do
        @list = @interval.reduce(Hamster.list) { |list, i| list.cons(i) }
      end

      after do
        @list.to_ary
      end

    end

    describe "enables explicit conversion to" do

      before do
        @list = Hamster.list("A", "B", "C")
      end

      it "arrays" do
        array = *@list
        array.should == ["A", "B", "C"]
      end

      it "call parameters" do
        [@list].each do |a, b, c|
          a.should == "A"
          b.should == "B"
          c.should == "C"
        end
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hamster-0.1.16 spec/hamster/list/to_ary_spec.rb