rubyx/test/parfait/test_vool_method.rb
Torsten Rüger ba83affd8c fix resolve issue
the typed method has to be created in the to_pafait pass for it to work correctly, ie for the sends to have something to call

also means that when during compilation creating (raising?) a  method, not only vool. but also callable has to be created
2019-09-29 22:37:28 +03:00

33 lines
892 B
Ruby

require_relative "helper"
module Vool
class TestVoolMethod < MiniTest::Test
include VoolCompile
def setup
Parfait.boot!(Parfait.default_test_options)
ruby_tree = Ruby::RubyCompiler.compile( as_main("a = 5") )
@clazz = ruby_tree.to_vool
end
def method
@clazz.body.first
end
def test_setup
assert_equal ClassExpression , @clazz.class
assert_equal Statements , @clazz.body.class
assert_equal MethodExpression , method.class
end
def test_class
assert_equal Parfait::Class , @clazz.to_parfait.class
end
def test_method
clazz = @clazz.to_parfait
assert_equal Parfait::VoolMethod , clazz.get_instance_method(:main).class
end
def test_type_method
clazz = @clazz.to_parfait
assert_equal Parfait::CallableMethod , clazz.instance_type.get_method(:main).class
end
end
end