add a helper to get the vool equivalent of a ruby class
This commit is contained in:
parent
77be0d3f73
commit
7b4a0126f7
@ -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
|
||||
|
23
test/ruby/test_statement.rb
Normal file
23
test/ruby/test_statement.rb
Normal 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
|
Loading…
x
Reference in New Issue
Block a user