testing to_s on Code

This commit is contained in:
Torsten Ruger 2016-12-28 13:59:02 +02:00
parent a8f3d5a634
commit 266764be06
3 changed files with 5 additions and 2 deletions

View File

@ -21,7 +21,7 @@ module Typed
end
class FalseExpression < Expression
def to_s
false
"false"
end
end
class NilExpression < Expression

View File

@ -6,6 +6,7 @@ module ExpressionHelper
Register.machine.boot unless Register.machine.booted
compiler = Typed::MethodCompiler.new Register.machine.space.get_main
code = Typed.ast_to_code @input
assert code.to_s , @input
produced = compiler.process( code )
assert @output , "No output given"
assert_equal produced.class , @output , "Wrong class"

View File

@ -13,7 +13,9 @@ module Statements
def check
assert @expect , "No output given"
compiler = Typed::MethodCompiler.new
produced = compiler.process( Typed.ast_to_code( @input) )
code = Typed.ast_to_code( @input )
assert code.to_s , @input
produced = compiler.process( code )
produced = Register.machine.space.get_main.instructions
compare_instructions produced , @expect
produced