mirror of
https://github.com/revanced/Apktool.git
synced 2025-05-01 14:44:26 +02:00
Don't propagate exceptions from RoundtripTest.runTest()
This commit is contained in:
parent
ce8a993bc7
commit
a01bf8c832
@ -31,11 +31,8 @@
|
|||||||
|
|
||||||
package org.jf.baksmali;
|
package org.jf.baksmali;
|
||||||
|
|
||||||
import org.antlr.runtime.RecognitionException;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class LambdaTest extends IdenticalRoundtripTest {
|
public class LambdaTest extends IdenticalRoundtripTest {
|
||||||
|
|
||||||
private baksmaliOptions createOptions() {
|
private baksmaliOptions createOptions() {
|
||||||
@ -46,7 +43,7 @@ public class LambdaTest extends IdenticalRoundtripTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testHelloWorldLambda() throws IOException, RecognitionException {
|
public void testHelloWorldLambda() {
|
||||||
runTest("HelloWorldLambda", createOptions());
|
runTest("HelloWorldLambda", createOptions());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,20 +70,29 @@ public abstract class RoundtripTest {
|
|||||||
return String.format("%s%s%sOutput.smali", testDir, File.separatorChar, testName);
|
return String.format("%s%s%sOutput.smali", testDir, File.separatorChar, testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runTest(@Nonnull String testName, @Nonnull baksmaliOptions options)
|
protected void runTest(@Nonnull String testName) {
|
||||||
throws IOException, RecognitionException {
|
runTest(testName, new baksmaliOptions());
|
||||||
// Load file from resources as a stream
|
}
|
||||||
String inputFilename = getInputFilename(testName);
|
|
||||||
String input = readResourceFully(getInputFilename(testName));
|
|
||||||
String output;
|
|
||||||
if (getOutputFilename(testName).equals(inputFilename)) {
|
|
||||||
output = input;
|
|
||||||
} else {
|
|
||||||
output = readResourceFully(getOutputFilename(testName));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Run smali, baksmali, and then compare strings are equal (minus comments/whitespace)
|
protected void runTest(@Nonnull String testName, @Nonnull baksmaliOptions options) {
|
||||||
BaksmaliTestUtils.assertSmaliCompiledEquals(input, output, options, true);
|
try {
|
||||||
|
// Load file from resources as a stream
|
||||||
|
String inputFilename = getInputFilename(testName);
|
||||||
|
String input = readResourceFully(getInputFilename(testName));
|
||||||
|
String output;
|
||||||
|
if (getOutputFilename(testName).equals(inputFilename)) {
|
||||||
|
output = input;
|
||||||
|
} else {
|
||||||
|
output = readResourceFully(getOutputFilename(testName));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run smali, baksmali, and then compare strings are equal (minus comments/whitespace)
|
||||||
|
BaksmaliTestUtils.assertSmaliCompiledEquals(input, output, options, true);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
Assert.fail();
|
||||||
|
} catch (RecognitionException ex) {
|
||||||
|
Assert.fail();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
Loading…
x
Reference in New Issue
Block a user