Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
00a6b6ef
Commit
00a6b6ef
authored
Sep 28, 2013
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core: add tests options, change log format
parent
04ac3b2e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
6 deletions
+31
-6
InternalJadxTest.java
jadx-core/src/test/java/jadx/api/InternalJadxTest.java
+18
-6
logback.xml
jadx-core/src/test/resources/logback.xml
+13
-0
No files found.
jadx-core/src/test/java/jadx/api/InternalJadxTest.java
View file @
00a6b6ef
...
...
@@ -21,10 +21,12 @@ import static junit.framework.Assert.fail;
public
abstract
class
InternalJadxTest
{
protected
boolean
outputCFG
=
false
;
protected
String
outDir
=
"test-out-tmp"
;
public
ClassNode
getClassNode
(
Class
<?>
clazz
)
{
try
{
File
temp
=
getJarForClass
(
clazz
);
Decompiler
d
=
new
Decompiler
();
try
{
d
.
loadFile
(
temp
);
...
...
@@ -34,14 +36,23 @@ public abstract class InternalJadxTest {
}
finally
{
temp
.
delete
();
}
List
<
ClassNode
>
classes
=
d
.
getRoot
().
getClasses
(
false
);
ClassNode
cls
=
classes
.
get
(
0
);
assertEquals
(
cls
.
getFullName
(),
clazz
.
getName
());
cls
.
load
();
List
<
IDexTreeVisitor
>
passes
=
Jadx
.
getPassesList
(
new
DefaultJadxArgs
(),
null
);
List
<
IDexTreeVisitor
>
passes
=
Jadx
.
getPassesList
(
new
DefaultJadxArgs
()
{
@Override
public
boolean
isCFGOutput
()
{
return
outputCFG
;
}
@Override
public
boolean
isRawCFGOutput
()
{
return
outputCFG
;
}
},
new
File
(
outDir
));
for
(
IDexTreeVisitor
visitor
:
passes
)
{
DepthTraverser
.
visit
(
visitor
,
cls
);
}
...
...
@@ -78,10 +89,10 @@ public abstract class InternalJadxTest {
String
path
=
cutPackage
(
cls
)
+
".class"
;
URL
resource
=
cls
.
getResource
(
path
);
if
(
resource
==
null
)
{
throw
new
AssertionError
(
"Class file not found: "
+
path
);
fail
(
"Class file not found: "
+
path
);
}
if
(!
"file"
.
equalsIgnoreCase
(
resource
.
getProtocol
()))
{
throw
new
IllegalStateException
(
"Class is not stored in a file."
);
fail
(
"Class is not stored in a file."
);
}
return
new
File
(
resource
.
getPath
());
}
...
...
@@ -109,8 +120,9 @@ public abstract class InternalJadxTest {
}
target
.
closeEntry
();
}
finally
{
if
(
in
!=
null
)
if
(
in
!=
null
)
{
in
.
close
();
}
}
}
}
jadx-core/src/test/resources/logback.xml
0 → 100644
View file @
00a6b6ef
<configuration>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
%d{HH:mm:ss} %-5level - %msg%n
</pattern>
</encoder>
</appender>
<root
level=
"DEBUG"
>
<appender-ref
ref=
"STDOUT"
/>
</root>
</configuration>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment