From 6f9955a7263ca706eae06dd1753ee76afcabc0cc Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 16 Dec 2016 01:14:09 +0200 Subject: [PATCH] more auto guard rules and related renaming of files --- Guardfile | 21 ++++--------------- lib/typed/parfait/object.rb | 2 +- test/typed/parfait/test_all.rb | 5 +++-- test/typed/parfait/test_attributes.rb | 6 +----- test/typed/parfait/test_frame.rb | 19 +++++++++++++++++ .../{test_meta.rb => test_meta_class.rb} | 0 .../{test_method.rb => test_typed_method.rb} | 0 7 files changed, 28 insertions(+), 25 deletions(-) create mode 100644 test/typed/parfait/test_frame.rb rename test/typed/parfait/{test_meta.rb => test_meta_class.rb} (100%) rename test/typed/parfait/{test_method.rb => test_typed_method.rb} (100%) diff --git a/Guardfile b/Guardfile index 1bb86116..9461c70c 100644 --- a/Guardfile +++ b/Guardfile @@ -10,22 +10,9 @@ guard :minitest do #Arm instructions watch(%r{^lib/arm/instructions/(.+)_instruction.rb}) { |m| "test/arm/test_#{m[1]}.rb" } - # with Minitest::Spec - # watch(%r{^spec/(.*)_spec\.rb$}) - # watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } - # watch(%r{^spec/spec_helper\.rb$}) { 'spec' } + #parfait basics + watch(%r{^lib/typed/parfait/(.+).rb}) { |m| "test/typed/parfait/test_#{m[1]}.rb" } + 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" } - # Rails 4 - # watch(%r{^app/(.+)\.rb$}) { |m| "test/#{m[1]}_test.rb" } - # watch(%r{^app/controllers/application_controller\.rb$}) { 'test/controllers' } - # watch(%r{^app/controllers/(.+)_controller\.rb$}) { |m| "test/integration/#{m[1]}_test.rb" } - # watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" } - # watch(%r{^lib/(.+)\.rb$}) { |m| "test/lib/#{m[1]}_test.rb" } - # watch(%r{^test/.+_test\.rb$}) - # watch(%r{^test/test_helper\.rb$}) { 'test' } - - # Rails < 4 - # watch(%r{^app/controllers/(.*)\.rb$}) { |m| "test/functional/#{m[1]}_test.rb" } - # watch(%r{^app/helpers/(.*)\.rb$}) { |m| "test/helpers/#{m[1]}_test.rb" } - # watch(%r{^app/models/(.*)\.rb$}) { |m| "test/unit/#{m[1]}_test.rb" } end diff --git a/lib/typed/parfait/object.rb b/lib/typed/parfait/object.rb index d85a59d7..88d1b5ae 100644 --- a/lib/typed/parfait/object.rb +++ b/lib/typed/parfait/object.rb @@ -15,7 +15,7 @@ module Parfait TYPE_INDEX = 1 - class Object + class Object # we define new, so we can do memory layout also at compile time. # At compile time we fake memory by using a global array for pages diff --git a/test/typed/parfait/test_all.rb b/test/typed/parfait/test_all.rb index 0e23a591..ec4bdc80 100644 --- a/test/typed/parfait/test_all.rb +++ b/test/typed/parfait/test_all.rb @@ -1,10 +1,11 @@ require_relative "test_attributes" require_relative "test_class" require_relative "test_dictionary" +require_relative "test_frame" require_relative "test_list" require_relative "test_message" -require_relative "test_meta" -require_relative "test_method" +require_relative "test_meta_class" +require_relative "test_typed_method" require_relative "test_object" require_relative "test_space" require_relative "test_word" diff --git a/test/typed/parfait/test_attributes.rb b/test/typed/parfait/test_attributes.rb index 75292397..87f9aed4 100644 --- a/test/typed/parfait/test_attributes.rb +++ b/test/typed/parfait/test_attributes.rb @@ -10,11 +10,7 @@ class TestAttributes < MiniTest::Test def test_message_get_type assert_equal Parfait::Type , @type.class end - def test_message_type_first - @type.object_class = :next_message - assert_equal :type , @type.instance_names.first - assert_equal :next_message , @type.object_class - end + def test_message_name_nil last = @type.instance_names.last assert_equal :indexed_length , last , @type.instance_names.inspect diff --git a/test/typed/parfait/test_frame.rb b/test/typed/parfait/test_frame.rb new file mode 100644 index 00000000..a5c6d915 --- /dev/null +++ b/test/typed/parfait/test_frame.rb @@ -0,0 +1,19 @@ +require_relative "../helper" + +class TestFrames < MiniTest::Test + + def setup + @frame = Register.machine.boot.space.first_message.frame + @type = @frame.get_type + end + + def test_frame_get_type + assert_equal Parfait::Type , @type.class + end + + def test_frame_next_set + @frame.next_frame = :next_frame + assert_equal :next_frame , @frame.next_frame + end + +end diff --git a/test/typed/parfait/test_meta.rb b/test/typed/parfait/test_meta_class.rb similarity index 100% rename from test/typed/parfait/test_meta.rb rename to test/typed/parfait/test_meta_class.rb diff --git a/test/typed/parfait/test_method.rb b/test/typed/parfait/test_typed_method.rb similarity index 100% rename from test/typed/parfait/test_method.rb rename to test/typed/parfait/test_typed_method.rb