small test setup fixes
This commit is contained in:
parent
6d4347c7ba
commit
a3e8d19bb7
@ -4,21 +4,19 @@ require_relative '../helper'
|
|||||||
module Statements
|
module Statements
|
||||||
include AST::Sexp
|
include AST::Sexp
|
||||||
|
|
||||||
|
def setup
|
||||||
|
Register.machine.boot # force boot to reset main
|
||||||
|
end
|
||||||
|
|
||||||
def check
|
def check
|
||||||
assert @expect , "No output given"
|
assert @expect , "No output given"
|
||||||
Register.machine.boot # force boot to reset main
|
|
||||||
compiler = Typed::Compiler.new Register.machine.space.get_main
|
compiler = Typed::Compiler.new Register.machine.space.get_main
|
||||||
produced = compiler.process( Typed.ast_to_code( @input) )
|
produced = compiler.process( Typed.ast_to_code( @input) )
|
||||||
assert_nil produced.first , "Statements should result in nil"
|
|
||||||
produced = Register.machine.space.get_main.instructions
|
produced = Register.machine.space.get_main.instructions
|
||||||
compare_instructions produced , @expect
|
compare_instructions produced , @expect
|
||||||
produced
|
produced
|
||||||
end
|
end
|
||||||
|
|
||||||
def as_main(statements)
|
|
||||||
s(:statements, s(:class, :Space, s(:derives, nil), statements ))
|
|
||||||
end
|
|
||||||
|
|
||||||
def compare_instructions instruction , expect
|
def compare_instructions instruction , expect
|
||||||
index = 0
|
index = 0
|
||||||
start = instruction
|
start = instruction
|
||||||
|
@ -4,4 +4,6 @@ require_relative "type/test_all"
|
|||||||
|
|
||||||
require_relative "expressions/test_all"
|
require_relative "expressions/test_all"
|
||||||
|
|
||||||
|
require_relative "statements/test_all"
|
||||||
|
|
||||||
require_relative "test_to_code"
|
require_relative "test_to_code"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user