Sha256: 182a5f76129d788f842ef0409ef59df47ebd27cf9cec9e7241a3582fa1168afd

Contents?: true

Size: 875 Bytes

Versions: 6

Compression:

Stored size: 875 Bytes

Contents

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

require 'hamster/set'

describe Hamster::List do

  describe "#inspect" do

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

      it "stream" do
        @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH)
      end

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

      after do
        @list.inspect
      end

    end

    [
      [[], "{}"],
      [["A"], "{\"A\"}"],
      [[1, 2, 3], "{1, 2, 3}"]
    ].each do |values, expected|

      describe "on #{values.inspect}" do

        before do
          original = Hamster.set(*values)
          @result = original.inspect
        end

        it "returns #{expected.inspect}" do
          @result.should == expected
        end

      end

    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hamster-0.2.2 spec/hamster/set/inspect_spec.rb
hamster-0.2.1 spec/hamster/set/inspect_spec.rb
hamster-0.2.0 spec/hamster/set/inspect_spec.rb
hamster-0.1.23 spec/hamster/set/inspect_spec.rb
hamster-0.1.22 spec/hamster/set/inspect_spec.rb
hamster-0.1.21 spec/hamster/set/inspect_spec.rb