Sha256: 67b61a04fb97890308261cd71fd30a477f5a3d526641ede2d3f07b454ca4539c
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/list' describe Hamster::List do describe "#each" 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.each { } end end [ [], ["A"], ["A", "B", "C"], ].each do |values| describe "on #{values.inspect}" do before do @list = Hamster.list(*values) end describe "with a block" do it "iterates over the items in order" do items = [] @list.each { |value| items << value } items.should == values end it "returns nil" do @list.each { "flibble" }.should be_nil end end describe "without a block" do it "returns self" do @list.each.should equal(@list) end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.16 | spec/hamster/list/each_spec.rb |