SlotLanguageExploration
This commit is contained in:
@ -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
|
||||
|
13
test/slot_language/test_slot_maker.rb
Normal file
13
test/slot_language/test_slot_maker.rb
Normal 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
|
Reference in New Issue
Block a user