Sha256: aadf154d00708b151bd2c984677c5fd32e547d705b0caf3f033e718b0e67df52

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

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

describe "Standard Library" do
  describe "set!" do
    before :each do
      @interpreter = Flea::Interpreter.new
    end
    
    it "should change the value of an existing variable" do
      @interpreter.run('
        (define test 1)
        (set! test 2)')
      @interpreter.base_environment.find(:test).should == 2
    end
    
    it "should raise error when attempting to set unbound variable" do
      lambda {
        @interpreter.run('(set! test 1)')
      }.should raise_error
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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