~tim/scheme-vm

ref: e3ea9b9b3ff5b87f50cb7990ccdc5004a35caddc scheme-vm/spec/lib_spec.rb -rw-r--r-- 646 bytes
e3ea9b9bTim Morgan Refactor import bindings 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
require_relative './spec_helper'
require 'stringio'

Dir[File.expand_path('../lib/**/*.scm', __FILE__)].each do |path|
  describe File.split(path).last do
    code = File.read(path)
    focus = !(code =~ /^;; focus/).nil? || ENV['SCM_FILE'] == path[-ENV['SCM_FILE'].to_s.size..-1]
    skip = !(code =~ /^;; skip/).nil?
    debug = code =~ /^;; debug/ ? 2 : 0
    it 'passes all tests', focus: focus, skip: skip do
      out = StringIO.new
      program = Program.new(code, filename: path, stdout: out)
      program.debug = debug
      program.run
      out.rewind
      result = out.read
      raise result unless result == ''
    end
  end
end