soml was updated to have a typed ast layer to make programatic creation easier this brings LOTS of syntax change with it, that does not really mean anything at all All tests pass again so back to the same
57 lines
1003 B
Ruby
57 lines
1003 B
Ruby
require_relative 'helper'
|
|
|
|
module Register
|
|
class TestClassStatements < MiniTest::Test
|
|
include Statements
|
|
|
|
def test_class_defs
|
|
@string_input = <<HERE
|
|
class Bar
|
|
int self.buh()
|
|
return 1
|
|
end
|
|
end
|
|
class Space
|
|
int main()
|
|
return 1
|
|
end
|
|
end
|
|
HERE
|
|
@expect = [Label, LoadConstant,SetSlot,Label,FunctionReturn]
|
|
check
|
|
end
|
|
|
|
def test_class_call
|
|
@string_input = <<HERE
|
|
class Bar
|
|
int self.buh()
|
|
return 1
|
|
end
|
|
end
|
|
class Space
|
|
int main()
|
|
return Bar.buh()
|
|
end
|
|
end
|
|
HERE
|
|
@expect = [Label, GetSlot, LoadConstant, SetSlot, LoadConstant, SetSlot, LoadConstant ,
|
|
SetSlot, LoadConstant, SetSlot, RegisterTransfer, FunctionCall, Label, RegisterTransfer ,
|
|
GetSlot, GetSlot, SetSlot, Label, FunctionReturn]
|
|
check
|
|
end
|
|
|
|
def test_class_field
|
|
@string_input = <<HERE
|
|
class Space
|
|
field int boo2
|
|
int main()
|
|
return self.boo2
|
|
end
|
|
end
|
|
HERE
|
|
@expect = [Label, GetSlot,GetSlot,SetSlot,Label,FunctionReturn]
|
|
check
|
|
end
|
|
end
|
|
end
|