2019-07-22 14:21:16 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Vool
|
|
|
|
class TestVoolMethod < MiniTest::Test
|
2019-08-08 11:18:36 +02:00
|
|
|
include VoolCompile
|
2019-07-22 14:21:16 +02:00
|
|
|
|
|
|
|
def setup
|
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
2019-09-12 12:10:31 +02:00
|
|
|
ruby_tree = Ruby::RubyCompiler.compile( as_main("a = 5") )
|
2019-08-08 11:18:36 +02:00
|
|
|
@clazz = ruby_tree.to_vool
|
|
|
|
end
|
|
|
|
def method
|
|
|
|
@clazz.body.first
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
|
|
|
def test_setup
|
2019-08-19 14:23:57 +02:00
|
|
|
assert_equal ClassExpression , @clazz.class
|
2019-08-08 11:18:36 +02:00
|
|
|
assert_equal Statements , @clazz.body.class
|
2019-08-19 14:23:57 +02:00
|
|
|
assert_equal MethodExpression , method.class
|
2019-08-08 11:18:36 +02:00
|
|
|
end
|
|
|
|
def test_class
|
2019-09-24 14:44:33 +02:00
|
|
|
assert_equal Parfait::Class , @clazz.to_parfait.class
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
2019-08-08 11:18:36 +02:00
|
|
|
def test_method
|
2019-09-24 14:44:33 +02:00
|
|
|
clazz = @clazz.to_parfait
|
|
|
|
assert_equal Parfait::VoolMethod , method.to_parfait(clazz).class
|
2019-08-08 11:18:36 +02:00
|
|
|
end
|
2019-07-22 14:21:16 +02:00
|
|
|
end
|
|
|
|
end
|