SlotLanguageExploration

This commit is contained in:
2019-10-04 21:06:22 +03:00
parent 901f7b0132
commit 9885841eb4
5 changed files with 69 additions and 5 deletions

View File

@ -2,14 +2,24 @@ require_relative "helper"
module SlotLanguage
class TestSlotCompiler < MiniTest::Test
include SlotHelper
def test_init
assert SlotCompiler.new
end
def test_compile
assert_equal SlotMaker , SlotCompiler.compile("a").class
assert_equal SlotMaker , compile("a").class
end
def test_fail_args
assert_raises{ SlotCompiler.compile("a(1)")}
# 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
end
def test_slot_load
compile("a = @b")
end
end
end

View File

@ -0,0 +1,13 @@
require_relative "helper"
module SlotLanguage
class TestSlotMaker < MiniTest::Test
include SlotHelper
def test_label
label = compile("while_label")
assert_equal SlotMachine::Label , label.class
assert_equal :while_label , label.name
end
end
end