create a load on the compiler

thus removing the need for << with objects on RegisterValue
This commit is contained in:
2020-03-01 10:52:21 +02:00
parent 95f3eec043
commit 64d860b2bf
7 changed files with 48 additions and 92 deletions

View File

@ -1,13 +1,5 @@
require_relative "helper"
module Risc
class FakeCallableCompiler < CallableCompiler
def initialize(a,c)
super(a,c)
end
def source_name
"luke"
end
end
class TestCallableCompiler < MiniTest::Test
def setup
Parfait.boot!({})
@ -29,28 +21,15 @@ module Risc
def test_const
assert_equal Array , @compiler.constants.class
end
end
class TestFakeCallableCompiler < MiniTest::Test
def setup
Parfait.boot!({})
label = SlotMachine::Label.new("hi","ho")
@compiler = FakeCallableCompiler.new(FakeCallable.new , label)
def test_load_class
object = @compiler.load_object(Parfait.object_space)
assert_equal RegisterValue , object.class
assert object.is_object?
end
def test_ok
assert @compiler
end
def test_current
assert @compiler.current
end
def test_current_label
assert_equal Label , @compiler.current.class
assert_equal "ho" , @compiler.current.name
end
def test_slot
assert @compiler.risc_instructions
end
def test_const
assert_equal Array , @compiler.constants.class
def test_load_code
object = @compiler.load_object(Parfait.object_space)
assert_equal LoadConstant , @compiler.current.class
assert_equal Parfait::Space , @compiler.current.constant.class
end
end
end