add layout and class accessor and test

This commit is contained in:
Torsten Ruger 2015-11-07 19:38:52 +02:00
parent 484e2d19d4
commit 7523bac80a
4 changed files with 20 additions and 3 deletions

View File

@ -145,7 +145,7 @@ module Soml
end end
def self.load_parfait def self.load_parfait
["object"].each do |o| ["layout","object"].each do |o|
str = File.open(File.expand_path("parfait/#{o}.soml", File.dirname(__FILE__))).read str = File.open(File.expand_path("parfait/#{o}.soml", File.dirname(__FILE__))).read
syntax = Parser::Salama.new.parse_with_debug(str) syntax = Parser::Salama.new.parse_with_debug(str)
parts = Parser::Transform.new.apply(syntax) parts = Parser::Transform.new.apply(syntax)

View File

@ -0,0 +1,7 @@
class Layout < Object
Class object_class()
get_internal(1)
end
end

View File

@ -1,7 +1,12 @@
class Object class Object
Layout get_layout() Layout get_layout()
return get_internal(1) return get_internal(0)
end
Class get_class()
Layout l = get_layout()
return l.object_class()
end end
end end

View File

@ -1,6 +1,6 @@
require_relative 'helper' require_relative 'helper'
class TestObject < MiniTest::Test class TestLayoutRT < MiniTest::Test
include RuntimeTests include RuntimeTests
def test_main def test_main
@ -13,6 +13,11 @@ class TestObject < MiniTest::Test
check check
end end
def test_get_class
@string_input = "return get_class()"
check
end
end end