Sha256: 0d5d3d78a99fd8f40f90358ac6d051f2388c68042506500a1954c09d6ebeec95

Contents?: true

Size: 929 Bytes

Versions: 1

Compression:

Stored size: 929 Bytes

Contents

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

describe "Standard Library" do
  describe "display" do
    before :each do
      @interpreter = Flea::Interpreter.new
      @old_stdout = $stdout
      @buffer = StringIO.new
      $stdout = @buffer
    end
    
    it "should output simple literal" do
      @interpreter.run('(display 1)')
      @buffer.string.should == "1"
    end
    
    it "should output a list" do
      @interpreter.run('(display (quote (1 2 3)))')
      @buffer.string.should == "(1 2 3)"
    end
    
    it "should output true and false using Scheme external representation" do
      @interpreter.run('(display #t)(display #f)')
      @buffer.string.should == "#t#f"
    end
    
    it "should return the same value that it displayed" do
      result = @interpreter.run('(display "abc")')
      result.should == "abc"
    end
    
    after :each do
      $stdout = @old_stdout
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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