提交 acdaa958 编写于 作者: S Skylot

test(cli): add multiple input test (#936)

上级 278c5f61
......@@ -19,7 +19,7 @@ import jadx.core.utils.files.FileUtils;
public class JadxCLIArgs {
@Parameter(description = "<input file> (.apk, .dex, .jar, .class, .smali, .zip, .aar, .arsc)")
@Parameter(description = "<input files> (.apk, .dex, .jar, .class, .smali, .zip, .aar, .arsc)")
protected List<String> files = new ArrayList<>(1);
@Parameter(names = { "-d", "--output-dir" }, description = "output directory")
......
......@@ -10,7 +10,6 @@ import java.nio.file.PathMatcher;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
......@@ -38,16 +37,23 @@ public class TestInput {
decompile("class", "samples/HelloWorld.class");
}
private void decompile(String tmpDirName, String inputSample) throws URISyntaxException, IOException {
@Test
public void testMultipleInput() throws Exception {
decompile("multi", "samples/hello.dex", "samples/HelloWorld.smali");
}
private void decompile(String tmpDirName, String... inputSamples) throws URISyntaxException, IOException {
StringBuilder args = new StringBuilder();
Path tempDir = FileUtils.createTempDir(tmpDirName);
args.append("-v ");
args.append("-d ").append(tempDir.toAbsolutePath()).append(' ');
args.append("-v");
args.append(" -d ").append(tempDir.toAbsolutePath());
URL resource = getClass().getClassLoader().getResource(inputSample);
assertThat(resource).isNotNull();
String sampleFile = resource.toURI().getRawPath();
args.append(sampleFile);
for (String inputSample : inputSamples) {
URL resource = getClass().getClassLoader().getResource(inputSample);
assertThat(resource).isNotNull();
String sampleFile = resource.toURI().getRawPath();
args.append(' ').append(sampleFile);
}
int result = JadxCLI.execute(args.toString().split(" "));
assertThat(result).isEqualTo(0);
......
.class LHelloWorld;
.class Lsmali/HelloWorld;
.super Ljava/lang/Object;
.source "HelloWorld.java"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册