Skip to content
Browse files

Fixed spec issues with architecture loading

  • Loading branch information...
1 parent 6226073 commit 39833db5b90c8e613c1c40cd848e3001e78c1759 @farcaller farcaller committed Apr 19, 2012
Showing with 11 additions and 6 deletions.
  1. +4 −1 lib/indis-core/target.rb
  2. +7 −5 spec/indis-core/target_spec.rb
View
5 lib/indis-core/target.rb
@@ -64,7 +64,10 @@ def load
@format = @format_class.new(self, @io)
@format_class = nil
- @architecture = BinaryArchitecture.known_archs[@format.architecture].new(self)
+ archClass = BinaryArchitecture.known_archs[@format.architecture]
+ raise RuntimeError, "Architecture not defined" unless archClass
+ @architecture = archClass.new(self)
+
@vmmap = VMMap.new(self)
@format_load_complete = true
View
12 spec/indis-core/target_spec.rb
@@ -2,14 +2,16 @@
def macho_format_cls_double
double('MachO Class', magic: 0xfeedface, name: 'Mach-O',
- new: double('MachO',
- architecture: double('Architecture Class',
- new:double('Architecture')
- )
- )
+ new: double('MachO', architecture: :test)
)
end
+module Indis; module BinaryArchitecture;
+ class TestArch < Architecture
+ def self.name; :test; end
+ end
+end; end
+
describe Indis::Target do
it "should require an existing file to operate" do
expect { Indis::Target.new("qwerty") }.to raise_error

0 comments on commit 39833db

Please sign in to comment.
Something went wrong with that request. Please try again.