mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-13 06:17:46 +01: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;
|
||||
|
||||
import org.antlr.runtime.RecognitionException;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LambdaTest extends IdenticalRoundtripTest {
|
||||
|
||||
private baksmaliOptions createOptions() {
|
||||
@ -46,7 +43,7 @@ public class LambdaTest extends IdenticalRoundtripTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHelloWorldLambda() throws IOException, RecognitionException {
|
||||
public void testHelloWorldLambda() {
|
||||
runTest("HelloWorldLambda", createOptions());
|
||||
}
|
||||
}
|
||||
|
@ -70,20 +70,29 @@ public abstract class RoundtripTest {
|
||||
return String.format("%s%s%sOutput.smali", testDir, File.separatorChar, testName);
|
||||
}
|
||||
|
||||
protected void runTest(@Nonnull String testName, @Nonnull baksmaliOptions options)
|
||||
throws IOException, RecognitionException {
|
||||
// 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));
|
||||
}
|
||||
protected void runTest(@Nonnull String testName) {
|
||||
runTest(testName, new baksmaliOptions());
|
||||
}
|
||||
|
||||
// Run smali, baksmali, and then compare strings are equal (minus comments/whitespace)
|
||||
BaksmaliTestUtils.assertSmaliCompiledEquals(input, output, options, true);
|
||||
protected void runTest(@Nonnull String testName, @Nonnull baksmaliOptions options) {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user