rubyx/test/vm/method_compiler/test_field_access.rb

35 lines
829 B
Ruby
Raw Normal View History

2015-11-07 11:18:08 +01:00
require_relative "helper"
2015-10-22 17:16:29 +02:00
module Register
class TestFields < MiniTest::Test
2015-11-07 11:18:08 +01:00
include ExpressionHelper
2016-12-10 14:18:37 +01:00
include AST::Sexp
def setup
2015-10-22 17:16:29 +02:00
Register.machine.boot
end
def test_field_not_defined
@root = :field_access
@input = s(:field_access, s(:receiver, s(:known, :self)), s(:field, s(:ivar, :a)))
assert_raises(RuntimeError) { check }
end
2015-11-07 11:18:08 +01:00
def test_field_not_space
@root = :field_access
@input = s(:field_access, s(:receiver, s(:known, :self)), s(:field, s(:ivar, :space)))
2016-12-10 14:18:37 +01:00
2015-11-07 11:18:08 +01:00
assert_raises(RuntimeError) { check }
end
def test_field
2016-12-10 17:07:38 +01:00
add_space_field(:bro,:Object)
@root = :field_access
@input = s(:field_access,s(:receiver, s(:known, :self)),s(:field,s(:ivar, :bro)))
2015-10-14 20:34:18 +02:00
@output = Register::RegisterValue
check
end
end
end