small shuffle of test helpers, also guard helpers
This commit is contained in:
parent
f8cefcde3c
commit
ece017fa86
@ -4,6 +4,7 @@
|
||||
guard :minitest do
|
||||
# with Minitest::Unit
|
||||
watch(%r{^test/(.*)\/?test_(.*)\.rb$})
|
||||
watch(%r{^test/(.*/)?helper.rb$}) { |m| "test/#{m[1]}test_all.rb" }
|
||||
watch(%r{^lib/(.*/)?([^/]+)\.rb$}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
||||
watch(%r{^test/test_helper\.rb$}) { 'test' }
|
||||
|
||||
|
@ -19,6 +19,14 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
|
||||
|
||||
require 'salama'
|
||||
|
||||
module Compiling
|
||||
def clean_compile(clazz_name , method_name , args , statements)
|
||||
compiler = Typed::Compiler.new.create_method(clazz_name,method_name,args ).init_method
|
||||
compiler.process( Typed.ast_to_code( statements ) )
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
class Ignored
|
||||
def == other
|
||||
return false unless other.class == self.class
|
||||
|
@ -1,4 +1,4 @@
|
||||
require_relative "../../helper"
|
||||
require_relative "../helper"
|
||||
require "register/interpreter"
|
||||
|
||||
module Ticker
|
||||
@ -6,12 +6,17 @@ module Ticker
|
||||
|
||||
def setup
|
||||
machine = Register.machine.boot
|
||||
do_clean_compile
|
||||
Typed.compile( @input )
|
||||
machine.collect
|
||||
@interpreter = Register::Interpreter.new
|
||||
@interpreter.start Register.machine.init
|
||||
end
|
||||
|
||||
# must be after boot, but before main compile, to define method
|
||||
def do_clean_compile
|
||||
end
|
||||
|
||||
def check_chain should
|
||||
should.each_with_index do |name , index|
|
||||
got = ticks(1)
|
||||
|
@ -3,19 +3,16 @@ require_relative '../helper'
|
||||
|
||||
module Statements
|
||||
include AST::Sexp
|
||||
include Compiling
|
||||
|
||||
def setup
|
||||
Register.machine.boot # force boot to reset main
|
||||
end
|
||||
|
||||
def clean_compile(clazz_name , method_name , args , statements)
|
||||
compiler = Typed::Compiler.new.create_method(clazz_name,method_name,args ).init_method
|
||||
compiler.process( Typed.ast_to_code( statements ) )
|
||||
end
|
||||
|
||||
def check
|
||||
assert @expect , "No output given"
|
||||
compiler = Typed::Compiler.new Register.machine.space.get_main
|
||||
compiler = Typed::Compiler.new
|
||||
produced = compiler.process( Typed.ast_to_code( @input) )
|
||||
produced = Register.machine.space.get_main.instructions
|
||||
compare_instructions produced , @expect
|
||||
|
Loading…
x
Reference in New Issue
Block a user