add a helper to get the vool equivalent of a ruby class

This commit is contained in:
Torsten Ruger 2018-07-19 20:59:15 +03:00
parent 77be0d3f73
commit 7b4a0126f7
2 changed files with 29 additions and 0 deletions

View File

@ -12,6 +12,12 @@ module Ruby
strings.collect{|str| prefix + str}.join("\n")
end
def vool_brother
eval "Vool::#{class_name}"
end
def class_name
self.class.name.split("::").last
end
end
class Expression

View File

@ -0,0 +1,23 @@
require_relative "helper"
module Ruby
class TestStatement < MiniTest::Test
include RubyTests
def test_class_name
assert_equal "Statement" , Statement.new.class_name
end
def test_brother
assert_equal Vool::Statement , Statement.new.vool_brother
end
def test_yield
lst = compile( "yield")
assert_equal Vool::YieldStatement , lst.vool_brother
end
def test_assign
lst = compile( "a = 4")
assert_equal Vool::LocalAssignment , lst.vool_brother
end
end
end