diff --git a/lib/risc.rb b/lib/risc.rb index 4f63b684..7bb1654f 100644 --- a/lib/risc.rb +++ b/lib/risc.rb @@ -20,7 +20,7 @@ module Risc end require_relative "risc/padding" -require_relative "risc/position" +require_relative "risc/position/position" require_relative "risc/platform" require "parfait" require_relative "risc/parfait_adapter" diff --git a/lib/risc/position.rb b/lib/risc/position/position.rb similarity index 91% rename from lib/risc/position.rb rename to lib/risc/position/position.rb index 9e2654be..3936a5ef 100644 --- a/lib/risc/position.rb +++ b/lib/risc/position/position.rb @@ -82,7 +82,9 @@ module Risc log.debug "Setting #{pos.to_s(16)} for #{object.class}-#{object}" testing = self.at( pos ) position = for_at( object , pos , extra) - raise "Mismatch (at #{pos.to_s(16)}) was:#{position} #{position.class} #{position.object} , should #{testing}#{testing.class}" if testing and testing.class != position.class + if testing and testing.class != position.class + raise "Mismatch (at #{pos.to_s(16)}) was:#{position} #{position.class} #{position.object} , should #{testing}#{testing.class}" + end self.positions[object] = position position.init(pos , extra) @reverse_cache[position.at] = position unless object.is_a? Label @@ -102,6 +104,6 @@ module Risc end end end -require_relative "position/object_position" -require_relative "position/instruction_position" -require_relative "position/code_position" +require_relative "object_position" +require_relative "instruction_position" +require_relative "code_position" diff --git a/test/risc/test_position.rb b/test/risc/position/test_position.rb similarity index 97% rename from test/risc/test_position.rb rename to test/risc/position/test_position.rb index 933fada4..01431945 100644 --- a/test/risc/test_position.rb +++ b/test/risc/position/test_position.rb @@ -1,4 +1,4 @@ -require_relative "helper" +require_relative "../helper" module Risc class TestMachinePositions < MiniTest::Test