some class field tests
This commit is contained in:
parent
dc58dbe2fe
commit
b76c140d32
@ -12,10 +12,8 @@ module Soml
|
||||
#puts "Define field #{name} on class #{for_class.name}"
|
||||
index = for_class.object_layout.add_instance_variable( name ) #TODO need typing
|
||||
|
||||
if value
|
||||
value = process( value )
|
||||
raise "value #{value}" #tbc
|
||||
end
|
||||
# not sure how to run class code yet. later
|
||||
raise "value #{value}" if value
|
||||
|
||||
return nil # statements don't reurn values, only expressions
|
||||
end
|
||||
|
@ -20,5 +20,31 @@ HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
|
||||
def test_class_field_value
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
field int boo = 1
|
||||
int main()
|
||||
return 1
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,LoadConstant,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
assert_raises{check}
|
||||
end
|
||||
|
||||
def test_class_field
|
||||
@string_input = <<HERE
|
||||
class Object
|
||||
field int boo
|
||||
int main()
|
||||
return self.boo
|
||||
end
|
||||
end
|
||||
HERE
|
||||
@expect = [Label, SaveReturn,GetSlot,GetSlot,Label,RegisterTransfer,GetSlot,FunctionReturn]
|
||||
check
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user