2019-02-16 16:54:45 +01:00
|
|
|
require_relative "../helper"
|
|
|
|
|
|
|
|
module VoolBlocks
|
2019-10-03 19:55:41 +02:00
|
|
|
class TestClassAssignSlotMachine < MiniTest::Test
|
2019-02-16 16:54:45 +01:00
|
|
|
|
|
|
|
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
|
2019-09-24 16:25:19 +02:00
|
|
|
vool.to_parfait
|
2019-02-16 16:54:45 +01:00
|
|
|
begin
|
2019-10-03 19:55:41 +02:00
|
|
|
vool.to_slot(nil)
|
2019-09-24 16:25:19 +02:00
|
|
|
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-09-24 16:25:19 +02:00
|
|
|
vool.to_parfait
|
2019-10-03 19:55:41 +02:00
|
|
|
assert_equal SlotMachine::SlotCollection , vool.to_slot(nil).class
|
2019-02-16 22:24:16 +01:00
|
|
|
end
|
2019-02-16 16:54:45 +01:00
|
|
|
end
|
|
|
|
end
|