From 4a7cc7273298cf4c0be926ed21a239488297d3a7 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 30 Jun 2018 10:08:18 +0300 Subject: [PATCH] always list of methods in class improve vool test dirs --- Guardfile | 5 +---- lib/vool/class_statement.rb | 7 ++++--- test/support/compiling.rb | 2 +- test/vool/{to_mom => }/send/helper.rb | 2 +- test/vool/{to_mom => }/send/test_send_args_send.rb | 0 test/vool/{to_mom => }/send/test_send_cached_simple.rb | 0 test/vool/{to_mom => }/send/test_send_self.rb | 0 test/vool/{to_mom => }/send/test_send_simple.rb | 0 test/vool/{to_mom => }/send/test_send_simple_args.rb | 0 test/vool/{to_mom => }/send/test_send_simple_string.rb | 0 test/vool/{to_mom => }/test_assign.rb | 0 test/vool/{to_mom => }/test_if_condition.rb | 0 test/vool/{to_mom => }/test_if_no_else.rb | 0 test/vool/{to_mom => }/test_if_simple.rb | 0 test/vool/{to_mom => }/test_ivar.rb | 0 test/vool/{to_mom => }/test_local.rb | 0 test/vool/{to_mom => }/test_return.rb | 0 test/vool/{to_mom => }/test_while_condition.rb | 0 test/vool/{to_mom => }/test_while_simple.rb | 0 test/vool/{to_mom => }/test_yield_statement.rb | 0 test/vool/to_mom/helper.rb | 1 - 21 files changed, 7 insertions(+), 10 deletions(-) rename test/vool/{to_mom => }/send/helper.rb (97%) rename test/vool/{to_mom => }/send/test_send_args_send.rb (100%) rename test/vool/{to_mom => }/send/test_send_cached_simple.rb (100%) rename test/vool/{to_mom => }/send/test_send_self.rb (100%) rename test/vool/{to_mom => }/send/test_send_simple.rb (100%) rename test/vool/{to_mom => }/send/test_send_simple_args.rb (100%) rename test/vool/{to_mom => }/send/test_send_simple_string.rb (100%) rename test/vool/{to_mom => }/test_assign.rb (100%) rename test/vool/{to_mom => }/test_if_condition.rb (100%) rename test/vool/{to_mom => }/test_if_no_else.rb (100%) rename test/vool/{to_mom => }/test_if_simple.rb (100%) rename test/vool/{to_mom => }/test_ivar.rb (100%) rename test/vool/{to_mom => }/test_local.rb (100%) rename test/vool/{to_mom => }/test_return.rb (100%) rename test/vool/{to_mom => }/test_while_condition.rb (100%) rename test/vool/{to_mom => }/test_while_simple.rb (100%) rename test/vool/{to_mom => }/test_yield_statement.rb (100%) delete mode 100644 test/vool/to_mom/helper.rb diff --git a/Guardfile b/Guardfile index de31dca6..59d4824a 100644 --- a/Guardfile +++ b/Guardfile @@ -25,11 +25,8 @@ guard :minitest , all_on_start: false do # with Minitest::Unit # ruby compiler tests have a whole directory watch(%r{^lib/rubyx/ruby_compiler.rb}) { Dir["test/rubyx/ruby_compiler/test_*.rb"] } - # Vool to_mom compile process + # Ruby to vool compile process - watch(%r{^lib/vool/(.+)_statement.rb}) { |m| - [ Dir["test/vool/to_mom/test_#{m[1]}*.rb"] , "test/vool/statements/test_#{m[1]}.rb"] } watch(%r{^lib/vool/statements/send_statement.rb}) { - [ Dir["test/vool/to_mom/send/test_*.rb"] , "test/vool/statements/test_send_statement.rb"] } + [ Dir["test/vool/send/test_*.rb"] ] } # message setup watch(%r{^lib/mom/instruction/message_setup.rb}) { Dir["test/mom/send/test_setup*.rb"] } diff --git a/lib/vool/class_statement.rb b/lib/vool/class_statement.rb index bcd8080d..c9ff8bab 100644 --- a/lib/vool/class_statement.rb +++ b/lib/vool/class_statement.rb @@ -24,9 +24,10 @@ module Vool def to_mom( _ ) create_class_object - mom = nil #return mom for test purpose - self.each do |node| - mom = node.to_mom(@clazz) if node.is_a?(MethodStatement) + mom = [] + body.statements.each do |node| + raise "Only methods for now #{node}" unless node.is_a?(MethodStatement) + mom << node.to_mom(@clazz) end mom end diff --git a/test/support/compiling.rb b/test/support/compiling.rb index 0ab6dc9b..6037f257 100644 --- a/test/support/compiling.rb +++ b/test/support/compiling.rb @@ -31,7 +31,7 @@ module MomCompile @method = statements.clazz.get_method(:main) assert_equal Parfait::VoolMethod , @method.class #puts "#{res.class}" - res + res.first end def check_array( should , is ) diff --git a/test/vool/to_mom/send/helper.rb b/test/vool/send/helper.rb similarity index 97% rename from test/vool/to_mom/send/helper.rb rename to test/vool/send/helper.rb index 393ba2aa..e144cce3 100644 --- a/test/vool/to_mom/send/helper.rb +++ b/test/vool/send/helper.rb @@ -11,7 +11,7 @@ module Vool @ins = compile_first_method( send_method ) end - def test_compiles_not_array + def test_first_not_array assert Array != @ins.class , @ins end def test_class_compiles diff --git a/test/vool/to_mom/send/test_send_args_send.rb b/test/vool/send/test_send_args_send.rb similarity index 100% rename from test/vool/to_mom/send/test_send_args_send.rb rename to test/vool/send/test_send_args_send.rb diff --git a/test/vool/to_mom/send/test_send_cached_simple.rb b/test/vool/send/test_send_cached_simple.rb similarity index 100% rename from test/vool/to_mom/send/test_send_cached_simple.rb rename to test/vool/send/test_send_cached_simple.rb diff --git a/test/vool/to_mom/send/test_send_self.rb b/test/vool/send/test_send_self.rb similarity index 100% rename from test/vool/to_mom/send/test_send_self.rb rename to test/vool/send/test_send_self.rb diff --git a/test/vool/to_mom/send/test_send_simple.rb b/test/vool/send/test_send_simple.rb similarity index 100% rename from test/vool/to_mom/send/test_send_simple.rb rename to test/vool/send/test_send_simple.rb diff --git a/test/vool/to_mom/send/test_send_simple_args.rb b/test/vool/send/test_send_simple_args.rb similarity index 100% rename from test/vool/to_mom/send/test_send_simple_args.rb rename to test/vool/send/test_send_simple_args.rb diff --git a/test/vool/to_mom/send/test_send_simple_string.rb b/test/vool/send/test_send_simple_string.rb similarity index 100% rename from test/vool/to_mom/send/test_send_simple_string.rb rename to test/vool/send/test_send_simple_string.rb diff --git a/test/vool/to_mom/test_assign.rb b/test/vool/test_assign.rb similarity index 100% rename from test/vool/to_mom/test_assign.rb rename to test/vool/test_assign.rb diff --git a/test/vool/to_mom/test_if_condition.rb b/test/vool/test_if_condition.rb similarity index 100% rename from test/vool/to_mom/test_if_condition.rb rename to test/vool/test_if_condition.rb diff --git a/test/vool/to_mom/test_if_no_else.rb b/test/vool/test_if_no_else.rb similarity index 100% rename from test/vool/to_mom/test_if_no_else.rb rename to test/vool/test_if_no_else.rb diff --git a/test/vool/to_mom/test_if_simple.rb b/test/vool/test_if_simple.rb similarity index 100% rename from test/vool/to_mom/test_if_simple.rb rename to test/vool/test_if_simple.rb diff --git a/test/vool/to_mom/test_ivar.rb b/test/vool/test_ivar.rb similarity index 100% rename from test/vool/to_mom/test_ivar.rb rename to test/vool/test_ivar.rb diff --git a/test/vool/to_mom/test_local.rb b/test/vool/test_local.rb similarity index 100% rename from test/vool/to_mom/test_local.rb rename to test/vool/test_local.rb diff --git a/test/vool/to_mom/test_return.rb b/test/vool/test_return.rb similarity index 100% rename from test/vool/to_mom/test_return.rb rename to test/vool/test_return.rb diff --git a/test/vool/to_mom/test_while_condition.rb b/test/vool/test_while_condition.rb similarity index 100% rename from test/vool/to_mom/test_while_condition.rb rename to test/vool/test_while_condition.rb diff --git a/test/vool/to_mom/test_while_simple.rb b/test/vool/test_while_simple.rb similarity index 100% rename from test/vool/to_mom/test_while_simple.rb rename to test/vool/test_while_simple.rb diff --git a/test/vool/to_mom/test_yield_statement.rb b/test/vool/test_yield_statement.rb similarity index 100% rename from test/vool/to_mom/test_yield_statement.rb rename to test/vool/test_yield_statement.rb diff --git a/test/vool/to_mom/helper.rb b/test/vool/to_mom/helper.rb deleted file mode 100644 index 26258082..00000000 --- a/test/vool/to_mom/helper.rb +++ /dev/null @@ -1 +0,0 @@ -require_relative "../helper"