From 87133722b3f2ed00e2751b2f71eb456c381a53ca Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Wed, 12 Apr 2017 20:18:41 +0300 Subject: [PATCH] get guard to run several test on one change by setting up names accordingly --- Guardfile | 3 +++ lib/vool/statement.rb | 1 + lib/vool/statements/assignment_statement.rb | 10 ---------- lib/vool/statements/local_statement.rb | 14 ++++++++++++++ .../vool/statements/test_assignment_statement.rb | 1 + test/vool/statements/test_local.rb | 16 ++++++++++++++++ test/vool/test_all.rb | 1 + test/vool/to_mom/test_all.rb | 3 +++ .../to_mom/{test_assignemnt.rb => test_local.rb} | 2 +- 9 files changed, 40 insertions(+), 11 deletions(-) create mode 100644 lib/vool/statements/local_statement.rb create mode 100644 test/vool/statements/test_local.rb create mode 100644 test/vool/to_mom/test_all.rb rename test/vool/to_mom/{test_assignemnt.rb => test_local.rb} (96%) diff --git a/Guardfile b/Guardfile index 32eaef56..f3bb42f2 100644 --- a/Guardfile +++ b/Guardfile @@ -16,4 +16,7 @@ guard :minitest do watch(%r{^lib/typed/parfait/type.rb}) { |m| "test/typed/type/test_all.rb" } watch(%r{^lib/typed/parfait/typed_method.rb}) { |m| "test/typed/type/test_method_api.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"] } + end diff --git a/lib/vool/statement.rb b/lib/vool/statement.rb index c64fb807..beca3004 100644 --- a/lib/vool/statement.rb +++ b/lib/vool/statement.rb @@ -57,6 +57,7 @@ require_relative "statements/class_statement" require_relative "statements/hash_statement" require_relative "statements/if_statement" require_relative "statements/logical_statement" +require_relative "statements/local_statement" require_relative "statements/method_statement" require_relative "statements/return_statement" require_relative "statements/statements" diff --git a/lib/vool/statements/assignment_statement.rb b/lib/vool/statements/assignment_statement.rb index df17cc05..e9ad05d6 100644 --- a/lib/vool/statements/assignment_statement.rb +++ b/lib/vool/statements/assignment_statement.rb @@ -9,17 +9,7 @@ module Vool super end end - class LocalAssignment < Assignment - # used to collect frame information - def add_local( array ) - array << @name - end - def to_mom( method ) - Mom::SlotConstant.new([:message , :self , @name] , @value) - end - end - class InstanceAssignment < Assignment # used to collect type information def add_ivar( array ) diff --git a/lib/vool/statements/local_statement.rb b/lib/vool/statements/local_statement.rb new file mode 100644 index 00000000..0d39f8bf --- /dev/null +++ b/lib/vool/statements/local_statement.rb @@ -0,0 +1,14 @@ +module Vool + + class LocalAssignment < Assignment + # used to collect frame information + def add_local( array ) + array << @name + end + + def to_mom( method ) + Mom::SlotConstant.new([:message , :self , @name] , @value) + end + end + +end diff --git a/test/vool/statements/test_assignment_statement.rb b/test/vool/statements/test_assignment_statement.rb index 7d1e7080..2410dae2 100644 --- a/test/vool/statements/test_assignment_statement.rb +++ b/test/vool/statements/test_assignment_statement.rb @@ -21,5 +21,6 @@ module Vool assert_equal :foo , lst.name end + end end diff --git a/test/vool/statements/test_local.rb b/test/vool/statements/test_local.rb new file mode 100644 index 00000000..13fe1e96 --- /dev/null +++ b/test/vool/statements/test_local.rb @@ -0,0 +1,16 @@ +require_relative "helper" + +module Vool + class TestLocal < MiniTest::Test + + def test_local + lst = RubyCompiler.compile( "foo = bar") + assert_equal LocalAssignment , lst.class + end + def test_local_name + lst = RubyCompiler.compile( "foo = bar") + assert_equal :foo , lst.name + end + + end +end diff --git a/test/vool/test_all.rb b/test/vool/test_all.rb index e2d8254a..5413887f 100644 --- a/test/vool/test_all.rb +++ b/test/vool/test_all.rb @@ -1,3 +1,4 @@ require_relative "helper" require_relative "statements/test_all" require_relative "compilers/test_all" +require_relative "to_mom/test_all" diff --git a/test/vool/to_mom/test_all.rb b/test/vool/to_mom/test_all.rb new file mode 100644 index 00000000..8fb58fb5 --- /dev/null +++ b/test/vool/to_mom/test_all.rb @@ -0,0 +1,3 @@ +require_relative "helper" +require_relative "test_local" +require_relative "test_ivar_assignment" diff --git a/test/vool/to_mom/test_assignemnt.rb b/test/vool/to_mom/test_local.rb similarity index 96% rename from test/vool/to_mom/test_assignemnt.rb rename to test/vool/to_mom/test_local.rb index e0ea77d7..435d4a1a 100644 --- a/test/vool/to_mom/test_assignemnt.rb +++ b/test/vool/to_mom/test_local.rb @@ -1,7 +1,7 @@ require_relative "helper" module Vool - class TestAssignemnt < MiniTest::Test + class TestLocalMom < MiniTest::Test include CompilerHelper def setup