~tim/scheme-vm

scheme-vm/spec/spec_helper.rb -rw-r--r-- 552 bytes
00cdee12Tim Morgan Remove old code 3 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require_relative '../program'
require_relative '../vm'
require_relative '../compiler'
require_relative '../parser'

RSpec.configure do |c|
  c.filter_run focus: true
  c.run_all_when_everything_filtered = true

  def d(instructions, skip_libs: true)
    pretty = VM::PrettyPrinter.new(instructions).format
    if skip_libs
      pretty = pretty.slice_after('VM::ENDL').to_a.last
      if (import_index = pretty.rindex('VM::IMPORT_LIB'))
        pretty[(import_index + 4)..-1]
      else
        pretty
      end
    else
      pretty
    end
  end
end