rubyx/test/mom/test_callable_compiler.rb

31 lines
676 B
Ruby
Raw Normal View History

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
class TestCallableCompiler < MiniTest::Test
2019-07-22 14:21:16 +02:00
def setup
2019-08-08 11:18:36 +02:00
@compiler = FakeCallableCompiler.new(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