testing to_s on Code
This commit is contained in:
parent
a8f3d5a634
commit
266764be06
@ -21,7 +21,7 @@ module Typed
|
|||||||
end
|
end
|
||||||
class FalseExpression < Expression
|
class FalseExpression < Expression
|
||||||
def to_s
|
def to_s
|
||||||
false
|
"false"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
class NilExpression < Expression
|
class NilExpression < Expression
|
||||||
|
@ -6,6 +6,7 @@ module ExpressionHelper
|
|||||||
Register.machine.boot unless Register.machine.booted
|
Register.machine.boot unless Register.machine.booted
|
||||||
compiler = Typed::MethodCompiler.new Register.machine.space.get_main
|
compiler = Typed::MethodCompiler.new Register.machine.space.get_main
|
||||||
code = Typed.ast_to_code @input
|
code = Typed.ast_to_code @input
|
||||||
|
assert code.to_s , @input
|
||||||
produced = compiler.process( code )
|
produced = compiler.process( code )
|
||||||
assert @output , "No output given"
|
assert @output , "No output given"
|
||||||
assert_equal produced.class , @output , "Wrong class"
|
assert_equal produced.class , @output , "Wrong class"
|
||||||
|
@ -13,7 +13,9 @@ module Statements
|
|||||||
def check
|
def check
|
||||||
assert @expect , "No output given"
|
assert @expect , "No output given"
|
||||||
compiler = Typed::MethodCompiler.new
|
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
|
produced = Register.machine.space.get_main.instructions
|
||||||
compare_instructions produced , @expect
|
compare_instructions produced , @expect
|
||||||
produced
|
produced
|
||||||
|
Loading…
Reference in New Issue
Block a user