Sha256: 16f9510673a5b50ffa5a627da044497dd3093edd334d19e4bd1db06b9b10b587

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

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

describe "Standard Library" do
  describe "equality operator" do
    before :each do
      @interpreter = Flea::Interpreter.new
    end
    
    context "for an expression that should evaluate to true" do
      it "should return the equality of several arguments" do
        result = @interpreter.run('
          (= 2 2 2)
        ')
        result.should == true
      end
      
      it "should evaluate its arguments before comparing them" do
        result = @interpreter.run('
          (define a 2)
          (= a a a)
        ')
        result.should == true
      end
    end
    
    context "for an expression that should evaluate to false" do
      it "should return the equality of several arguments" do
        result = @interpreter.run('
          (= 2 2 4)
        ')
        result.should == false
      end
      
      it "should evaluate its arguments before comparing them" do
        result = @interpreter.run('
          (define a 2)
          (define b 3)
          (= a a b)
        ')
        result.should == false
      end
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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