fix constant propagation through the layers
so they can end up in the binary
This commit is contained in:
@ -6,7 +6,7 @@ module Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
@comp = compile_mom( "class Test ; def main(); return 1; end; end;")
|
||||
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
|
||||
end
|
||||
|
||||
def test_class
|
||||
@ -15,6 +15,12 @@ module Mom
|
||||
def test_compilers
|
||||
assert_equal 24 , @comp.method_compilers.length
|
||||
end
|
||||
def test_returns_constants
|
||||
assert_equal Array , @comp.constants.class
|
||||
end
|
||||
def test_has_constant
|
||||
assert_equal "Hi" , @comp.constants.first.to_string
|
||||
end
|
||||
def test_has_translate
|
||||
assert @comp.translate(:interpreter)
|
||||
end
|
||||
|
@ -6,13 +6,22 @@ module Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
@comp = compile_mom( "class Test ; def main(); return 1; end; end;")
|
||||
@comp = compile_mom( "class Test ; def main(); return 'Hi'; end; end;")
|
||||
@linker = @comp.translate(:interpreter)
|
||||
end
|
||||
|
||||
def test_translate_class
|
||||
assert_equal Risc::Linker , @linker.class
|
||||
end
|
||||
def test_linker_has_constants
|
||||
assert_equal Array , @linker.constants.class
|
||||
end
|
||||
def test_linker_constants_not_empty
|
||||
assert !@linker.constants.empty?
|
||||
end
|
||||
def test_linker_constants_contains_hi
|
||||
assert @linker.constants.include?("Hi")
|
||||
end
|
||||
def test_translate_platform
|
||||
assert_kind_of Risc::Platform , @linker.platform
|
||||
end
|
||||
|
Reference in New Issue
Block a user