2019-02-16 16:54:45 +01:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module VoolBlocks
|
|
|
|
class TestClassAssignMom < MiniTest::Test
|
|
|
|
|
|
|
|
def setup
|
|
|
|
Parfait.boot!(Parfait.default_test_options)
|
|
|
|
end
|
|
|
|
def as_class_method(source)
|
|
|
|
"class Space;def self.main();#{source};end;end"
|
|
|
|
end
|
|
|
|
def test_block_not_compiles
|
|
|
|
source = "main{|val| val = 0}"
|
|
|
|
vool = Ruby::RubyCompiler.compile( as_class_method(source) ).to_vool
|
|
|
|
begin
|
|
|
|
vool.to_mom(nil)
|
|
|
|
rescue => err
|
2019-02-16 22:24:16 +01:00
|
|
|
assert err.message.include?("Blocks") , err.message
|
2019-02-16 16:54:45 +01:00
|
|
|
end
|
|
|
|
end
|
2019-02-16 22:24:16 +01:00
|
|
|
def test_assign_compiles
|
|
|
|
vool = Ruby::RubyCompiler.compile( as_class_method("val = 0") ).to_vool
|
2019-08-07 14:08:45 +02:00
|
|
|
assert_equal Mom::MomCollection , vool.to_mom(nil).class
|
2019-02-16 22:24:16 +01:00
|
|
|
end
|
2019-02-16 16:54:45 +01:00
|
|
|
end
|
|
|
|
end
|