2019-10-04 16:38:51 +02:00
|
|
|
require_relative "helper"
|
|
|
|
|
|
|
|
module SlotLanguage
|
|
|
|
class TestSlotCompiler < MiniTest::Test
|
2019-10-04 20:06:22 +02:00
|
|
|
include SlotHelper
|
|
|
|
|
2019-10-04 16:38:51 +02:00
|
|
|
def test_init
|
|
|
|
assert SlotCompiler.new
|
|
|
|
end
|
|
|
|
def test_compile
|
2019-10-04 20:06:22 +02:00
|
|
|
assert_equal SlotMaker , compile("a").class
|
|
|
|
end
|
|
|
|
# def test_fail_args
|
|
|
|
# assert_raises{ compile("a(1)")}
|
|
|
|
# end
|
|
|
|
def test_label
|
|
|
|
label = compile("while_label")
|
|
|
|
assert_equal SlotMachine::Label , label.class
|
|
|
|
assert_equal :while_label , label.name
|
2019-10-04 16:38:51 +02:00
|
|
|
end
|
2019-10-04 20:06:22 +02:00
|
|
|
def test_slot_load
|
|
|
|
compile("a = @b")
|
2019-10-04 16:38:51 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|