rubyx/stash/test_vm/method_compiler/test_field_access.rb
Torsten Ruger 5fe0ba06ab stash old vm
moving on to getting mom to work and can’t have both
interpreter and elf broke, about 100 tests  went
2018-03-11 17:02:42 +05:30

35 lines
813 B
Ruby

require_relative "helper"
module Risc
class TestFields < MiniTest::Test
include ExpressionHelper
include AST::Sexp
def setup
Risc.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
def test_field_not_space
@root = :field_access
@input = s(:field_access, s(:receiver, s(:known, :self)), s(:field, s(:ivar, :space)))
assert_raises(RuntimeError) { check }
end
def test_field
add_space_field(:bro,:Object)
@root = :field_access
@input = s(:field_access,s(:receiver, s(:known, :self)),s(:field,s(:ivar, :bro)))
@output = Risc::RiscValue
check
end
end
end