2019-07-22 14:21:16 +02:00
|
|
|
require_relative "helper"
|
|
|
|
module Mom
|
2019-08-08 11:18:36 +02:00
|
|
|
class FakeCallableCompiler < CallableCompiler
|
|
|
|
def source_name
|
|
|
|
"luke"
|
|
|
|
end
|
|
|
|
end
|
2019-08-07 11:06:06 +02:00
|
|
|
class TestCallableCompiler < MiniTest::Test
|
2019-07-22 14:21:16 +02:00
|
|
|
|
|
|
|
def setup
|
2019-09-15 17:31:10 +02:00
|
|
|
@compiler = FakeCallableCompiler.new(Risc::FakeCallable.new)
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
2019-08-08 11:18:36 +02:00
|
|
|
def test_ok
|
|
|
|
assert @compiler
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
2019-08-08 11:18:36 +02:00
|
|
|
def test_current
|
|
|
|
assert @compiler.current
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
2019-08-08 11:18:36 +02:00
|
|
|
def test_current_label
|
|
|
|
assert_equal Label , @compiler.current.class
|
|
|
|
assert_equal @compiler.source_name , @compiler.current.name
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
2019-08-08 11:18:36 +02:00
|
|
|
def test_mom
|
|
|
|
assert @compiler.mom_instructions
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
2019-08-08 11:18:36 +02:00
|
|
|
def test_const
|
|
|
|
assert_equal Array , @compiler.constants.class
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|