rubyx/test/mom/builtin/test_object.rb

70 lines
1.8 KiB
Ruby
Raw Normal View History

require_relative "helper"
module Mom
module Builtin
class TestObjectGet < BootTest
def setup
super
@method = get_object_compiler(:get_internal_word)
end
def test_has_get_internal
assert_equal Mom::MethodCompiler , @method.class
end
def test_mom_length
assert_equal 5 , @method.mom_instructions.length
end
def test_return
assert_equal ReturnSequence , @method.mom_instructions.next(3).class
end
end
class TestObjectSet < BootTest
2019-08-11 19:36:10 +02:00
def setup
super
@method = get_object_compiler(:set_internal_word)
2019-08-11 19:36:10 +02:00
end
def test_has_get_internal
assert_equal Mom::MethodCompiler , @method.class
end
def test_mom_length
assert_equal 5 , @method.mom_instructions.length
end
end
class TestObjectMissing < BootTest
2019-08-11 19:36:10 +02:00
def setup
super
@method = get_object_compiler(:_method_missing)
2019-08-11 19:36:10 +02:00
end
def test_has_get_internal
assert_equal Mom::MethodCompiler , @method.class
end
def test_mom_length
assert_equal 5 , @method.mom_instructions.length
end
end
class TestObjectExit < BootTest
2019-08-11 19:36:10 +02:00
def setup
super
@method = get_object_compiler(:exit)
2019-08-11 19:36:10 +02:00
end
def test_has_get_internal
assert_equal Mom::MethodCompiler , @method.class
end
def test_mom_length
assert_equal 5 , @method.mom_instructions.length
end
end
class TestObjectInit < BootTest
2019-08-11 19:36:10 +02:00
def setup
super
@method = get_object_compiler(:__init__)
2019-08-11 19:36:10 +02:00
end
def test_has_get_internal
assert_equal Mom::MethodCompiler , @method.class
end
def test_mom_length
assert_equal 2 , @method.mom_instructions.length
2019-08-11 19:36:10 +02:00
end
end
end
end