rubyx/test/melon/compiler/test_clollector.rb

30 lines
1.0 KiB
Ruby
Raw Normal View History

2016-12-20 14:46:23 +01:00
require_relative "helper"
module Melon
class TestCollector < MiniTest::Test
def setup
Register.machine.boot unless Register.machine.booted
end
def test_ivar_name
Compiler.compile "class TestIvar < Object ; def meth; @ivar;end; end"
itest = Parfait::Space.object_space.get_class_by_name(:TestIvar)
assert itest.instance_type.instance_names.include?(:ivar) , itest.instance_type.instance_names.inspect
end
def test_ivar_assign
Compiler.compile "class TestIvar2 < Object ; def meth; @ivar = 5 ;end; end"
itest = Parfait::Space.object_space.get_class_by_name(:TestIvar2)
assert itest.instance_type.instance_names.include?(:ivar) , itest.instance_type.instance_names.inspect
end
def test_ivar_operator_assign
Compiler.compile "class TestIvar3 < Object ; def meth; @ivar += 5 ;end; end"
itest = Parfait::Space.object_space.get_class_by_name(:TestIvar3)
assert itest.instance_type.instance_names.include?(:ivar) , itest.instance_type.instance_names.inspect
end
end
end