From 4f3a4387fc9fc7a014bc1898816b06b7ceac3bc6 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 4 Sep 2017 21:00:29 +0300 Subject: [PATCH] renaming to_mom tests and improve guard --- Guardfile | 2 +- ...{test_condition_if.rb => test_if_condition.rb} | 15 ++++++--------- .../{test_simple_if.rb => test_if_simple.rb} | 10 +++++----- 3 files changed, 12 insertions(+), 15 deletions(-) rename test/vool/to_mom/{test_condition_if.rb => test_if_condition.rb} (53%) rename test/vool/to_mom/{test_simple_if.rb => test_if_simple.rb} (58%) diff --git a/Guardfile b/Guardfile index 7a83bb82..085a1fee 100644 --- a/Guardfile +++ b/Guardfile @@ -20,6 +20,6 @@ guard :minitest do # with Minitest::Unit watch(%r{^lib/parfait/type.rb}) { Dir["test/parfait/type/test_*.rb"] } # Vool to_mom compile process + # Ruby to vool compile process - watch(%r{^lib/vool/statements/(.+)_statement.rb}) { |m| ["test/vool/to_mom/test_#{m[1]}.rb" ,"test/vool/statements/test_#{m[1]}.rb"] } + watch(%r{^lib/vool/statements/(.+)_statement.rb}) { |m| ["test/vool/to_mom/test_#{m[1]}*.rb" ,"test/vool/statements/test_#{m[1]}.rb"] } end diff --git a/test/vool/to_mom/test_condition_if.rb b/test/vool/to_mom/test_if_condition.rb similarity index 53% rename from test/vool/to_mom/test_condition_if.rb rename to test/vool/to_mom/test_if_condition.rb index 5546c05f..80baf03b 100644 --- a/test/vool/to_mom/test_condition_if.rb +++ b/test/vool/to_mom/test_if_condition.rb @@ -12,19 +12,16 @@ module Vool end def test_if_compiles_as_array - assert_equal Array , @first.class , @stats - end - def test_if_compiles_as_array_2 - assert_equal 5 , @first.length , @stats + assert_equal Mom::IfStatement , @first.class , @stats end def test_condition_compiles_to_slot - assert_equal Mom::SlotConstant , @first.first.class - end - def test_condition_compiles_to_check_second - assert_equal Mom::TruthCheck , @first[1].class + assert_equal Mom::TruthCheck , @first.condition.class end def test_condition_is_send - assert_equal Vool::LocalVariable , @first[1].condition.class + assert_equal Vool::LocalVariable , @first.condition.condition.class + end + def test_hoisetd + assert_equal Mom::SlotConstant , @first.hoisted.class end end end diff --git a/test/vool/to_mom/test_simple_if.rb b/test/vool/to_mom/test_if_simple.rb similarity index 58% rename from test/vool/to_mom/test_simple_if.rb rename to test/vool/to_mom/test_if_simple.rb index 4e5730c5..9569cf72 100644 --- a/test/vool/to_mom/test_simple_if.rb +++ b/test/vool/to_mom/test_if_simple.rb @@ -12,16 +12,16 @@ module Vool end def test_if_compiles_as_array - assert_equal Array , @first.class , @stats + assert_equal Mom::IfStatement , @first.class , @stats end def test_condition_compiles_to_check - assert_equal Mom::TruthCheck , @first.first.class , @stats + assert_equal Mom::TruthCheck , @first.condition.class , @stats end def test_condition_is_instance - assert_equal Vool::InstanceVariable , @first.first.condition.class , @stats + assert_equal Vool::InstanceVariable , @first.condition.condition.class , @stats end - def test_true_block_is_second - assert_equal @first[1] , @first.first.true_block , @stats + def test_nothing_hoisted + assert_nil @first.hoisted , @stats end end end