Sha256: e1fa31ad066578c4bdc8ff9b9c822502eaf0b9993907287ee34fa77d69e74785
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) require 'hamster/list' describe Hamster::List do [:include?, :member?, :contains?, :elem?].each do |method| describe "##{method}" do describe "on a really big list" do before do @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) end it "doesn't run out of stack" do lambda { @list.send(method, nil) }.should_not raise_error end end [ [[], "A", false], [[], nil, false], [["A"], "A", true], [["A"], "B", false], [["A"], nil, false], [["A", "B", nil], "A", true], [["A", "B", nil], "B", true], [["A", "B", nil], nil, true], [["A", "B", nil], "C", false], [[2], 2, true], [[2], 2.0, true], [[2.0], 2.0, true], [[2.0], 2, true], ].each do |values, item, expected| describe "on #{values.inspect}" do before do @list = Hamster.list(*values) end it "returns #{expected.inspect}" do @list.send(method, item).should == expected end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/list/include_spec.rb |
hamster-0.2.6 | spec/hamster/list/include_spec.rb |