2019-08-06 17:33:27 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module Mom
|
|
|
|
class TestMethodCompiler < MiniTest::Test
|
2019-08-07 14:08:45 +02:00
|
|
|
include ScopeHelper
|
2019-08-06 17:33:27 +02:00
|
|
|
|
|
|
|
def setup
|
|
|
|
end
|
|
|
|
|
2019-08-07 14:08:45 +02:00
|
|
|
def in_test_vool(str)
|
|
|
|
vool = RubyX::RubyXCompiler.new(RubyX.default_test_options).ruby_to_vool(in_Test(str))
|
|
|
|
vool.to_mom(nil)
|
|
|
|
vool
|
2019-08-06 17:33:27 +02:00
|
|
|
end
|
2019-08-07 14:08:45 +02:00
|
|
|
def create_method(body = "@ivar = 5")
|
|
|
|
in_test_vool("def meth; #{body};end")
|
|
|
|
test = Parfait.object_space.get_class_by_name(:Test)
|
|
|
|
test.get_method(:meth)
|
2019-08-06 17:33:27 +02:00
|
|
|
end
|
2019-08-07 14:08:45 +02:00
|
|
|
|
|
|
|
def test_method_has_source
|
|
|
|
method = create_method
|
|
|
|
assert_equal Vool::IvarAssignment , method.source.class
|
2019-08-06 17:33:27 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|