summaryrefslogtreecommitdiff
path: root/test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java')
-rw-r--r--test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java41
1 files changed, 3 insertions, 38 deletions
diff --git a/test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java b/test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java
index 476da87..2573648 100644
--- a/test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java
+++ b/test/java/com/google/devtools/build/android/desugar/BytecodeTypeInferenceTest.java
@@ -13,11 +13,8 @@
// limitations under the License.
package com.google.devtools.build.android.desugar;
-import static com.google.common.truth.Truth.assertThat;
-
-import com.google.common.collect.ImmutableMap;
import com.google.common.io.Files;
-import com.google.devtools.build.android.desugar.BytecodeTypeInference.InferredType;
+import com.google.common.truth.Truth;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
@@ -27,7 +24,6 @@ import java.nio.file.Paths;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import org.objectweb.asm.Label;
/** Test for {@link BytecodeTypeInference} */
@RunWith(JUnit4.class)
@@ -37,7 +33,7 @@ public class BytecodeTypeInferenceTest {
private static final Path GOLDEN_PATH = Paths.get(System.getProperty("golden_file"));
@Test
- public void testTypeInference() throws IOException {
+ public void test() throws IOException {
StringWriter stringWriter = new StringWriter();
try (PrintWriter printWriter = new PrintWriter(stringWriter)) {
ByteCodeTypePrinter.printClassesWithTypes(JAR_PATH, printWriter);
@@ -45,37 +41,6 @@ public class BytecodeTypeInferenceTest {
}
String inferenceResult = stringWriter.toString().trim();
String golden = Files.asCharSource(GOLDEN_PATH.toFile(), StandardCharsets.UTF_8).read().trim();
- assertThat(inferenceResult).isEqualTo(golden);
- }
-
- @Test
- public void testUninitializedInferType() {
- Label label = new Label();
- InferredType type = InferredType.createUninitializedType(label);
- assertThat(type.descriptor()).isEqualTo(InferredType.UNINITIALIZED_PREFIX);
- assertThat(type.uninitializationLabel()).isEqualTo(label);
- }
-
- @Test
- public void testNonUninitializedInferType() {
- ImmutableMap<String, InferredType> map =
- ImmutableMap.<String, InferredType>builder()
- .put("Z", InferredType.BOOLEAN)
- .put("B", InferredType.BYTE)
- .put("I", InferredType.INT)
- .put("F", InferredType.FLOAT)
- .put("D", InferredType.DOUBLE)
- .put("J", InferredType.LONG)
- .put("TOP", InferredType.TOP)
- .put("NULL", InferredType.NULL)
- .put("UNINITIALIZED_THIS", InferredType.UNINITIALIZED_THIS)
- .build();
- map.forEach(
- (descriptor, expected) -> {
- InferredType type = InferredType.createNonUninitializedType(descriptor);
- assertThat(type.uninitializationLabel()).isNull();
- assertThat(type.descriptor()).isEqualTo(descriptor);
- assertThat(type).isSameAs(expected);
- });
+ Truth.assertThat(inferenceResult).isEqualTo(golden);
}
}