Sha256: 017872f2babc8eda44fdcc7bc75bf14282e368e257b260a974c5ebb6285e49c9

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

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

describe "Standard Library" do
  describe "cons" do
    before :each do
      @interpreter = Flea::Interpreter.new
    end
    
    it "should create a list from an atom and an empty list" do
      result = @interpreter.run("(cons 'a '())")
      result.should == [:a]
    end
    
    it "should create a list from a pair of lists" do
      result = @interpreter.run("(cons '(a) '(b c d))")
      result.should == [[:a], :b, :c, :d]
    end
    
    it "should push an atom on an existing list" do
      result = @interpreter.run('(cons "a" \'(b c ))')
      result.should == ["a", :b, :c]
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
flea-0.1.0 spec/flea/standard_library/cons_spec.rb