Skip to content

Commit

Permalink
Tighten up regex
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebFenton committed Jul 26, 2016
1 parent ce1e2ce commit 2c11fe1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/dex-oracle/smali_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def parse_methods
body = nil
@content.each_line do |line|
if in_method
if /^\.end method/ =~ line
if /^\.end method$/ =~ line
in_method = false
@methods << SmaliMethod.new(@class, method_signature, body)
next
Expand Down
3 changes: 2 additions & 1 deletion spec/dex-oracle/smali_file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@
describe '#update' do
subject { smali_file.content }
it 'should update modified methods' do
allow(File).to receive(:open)
method = smali_file.methods.first
method.modified = true
method.body = "\nreturn-void\n"
# Make sure we don't save it
allow(File).to receive(:open)
smali_file.update
should eq ".class public LHelloWorld; # COMMENT;\n.super Ljava/lang/Object; # YEAH ;\n.implements Lsome/Interface1;\n.implements Lsome/Interface2;\n\n.field public static final someField:Z\n\n.method public static main([Ljava/lang/String;)V\nreturn-void\n.end method\n\n"
end
Expand Down

0 comments on commit 2c11fe1

Please sign in to comment.