Update DesugaredLibraryMismatchTest after change to markers validation
Change-Id: Ibde2f5209813ac3d5717cd36ac3815861d4250da
diff --git a/src/test/java/com/android/tools/r8/ToolHelper.java b/src/test/java/com/android/tools/r8/ToolHelper.java
index 3eebc4a..5fb11f1 100644
--- a/src/test/java/com/android/tools/r8/ToolHelper.java
+++ b/src/test/java/com/android/tools/r8/ToolHelper.java
@@ -268,7 +268,7 @@
V6_0_1("6.0.1"),
V7_0_0("7.0.0"),
V8_1_0("8.1.0"),
- // TODO(b//204855476): Remove DEFAULT.
+ // TODO(b/204855476): Remove DEFAULT.
DEFAULT("default"),
V9_0_0("9.0.0"),
V10_0_0("10.0.0"),
diff --git a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java
index 71026ba..9f50994 100644
--- a/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/desugaredlibrary/DesugaredLibraryMismatchTest.java
@@ -5,10 +5,8 @@
package com.android.tools.r8.desugar.desugaredlibrary;
import static com.android.tools.r8.DiagnosticsMatcher.diagnosticMessage;
-import static com.android.tools.r8.DiagnosticsMatcher.diagnosticType;
import static com.android.tools.r8.desugar.desugaredlibrary.test.CompilationSpecification.D8_L8DEBUG;
import static com.android.tools.r8.desugar.desugaredlibrary.test.LibraryDesugaringSpecification.getJdk8Jdk11;
-import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.CoreMatchers.containsString;
import com.android.tools.r8.CompilationFailedException;
@@ -18,7 +16,6 @@
import com.android.tools.r8.ToolHelper.DexVm.Version;
import com.android.tools.r8.desugar.desugaredlibrary.test.CompilationSpecification;
import com.android.tools.r8.desugar.desugaredlibrary.test.LibraryDesugaringSpecification;
-import com.android.tools.r8.errors.DesugaredLibraryMismatchDiagnostic;
import com.android.tools.r8.origin.Origin;
import com.google.common.collect.ImmutableList;
import java.nio.file.Path;
@@ -40,8 +37,7 @@
return buildParameters(
getTestParameters()
.withDexRuntime(Version.first())
- .withDexRuntime(Version.V7_0_0)
- .withDexRuntime(Version.V8_1_0)
+ .withDefaultDexRuntime()
.withDexRuntime(Version.last())
.withOnlyDexRuntimeApiLevel()
.build(),
@@ -82,8 +78,6 @@
containsString(
"The compilation is slowed down due to a mix of class file and dex"
+ " file inputs in the context of desugared library.")));
- diagnostics.assertErrorsMatch(
- diagnosticType(DesugaredLibraryMismatchDiagnostic.class));
} else {
diagnostics.assertNoMessages();
}
@@ -149,23 +143,11 @@
.writeToZip();
// Combine CF input with library desugaring with dexing without library desugaring.
- try {
- testForD8()
- .addProgramFiles(desugaredLibrary)
- .addProgramClasses(TestRunner.class)
- .setMinApi(parameters.getApiLevel())
- .compileWithExpectedDiagnostics(
- diagnostics -> {
- if (libraryDesugaringSpecification.hasAnyDesugaring(parameters)) {
- diagnostics.assertOnlyErrors();
- diagnostics.assertErrorsMatch(
- diagnosticType(DesugaredLibraryMismatchDiagnostic.class));
- } else {
- diagnostics.assertNoMessages();
- }
- });
- } catch (CompilationFailedException e) {
- }
+ testForD8()
+ .addProgramFiles(desugaredLibrary)
+ .addProgramClasses(TestRunner.class)
+ .setMinApi(parameters.getApiLevel())
+ .compile();
}
@Test
@@ -186,23 +168,11 @@
.compile()
.writeToZip();
- try {
- testForD8()
- .addProgramFiles(libraryDex)
- .addProgramFiles(programDex)
- .setMinApi(parameters.getApiLevel())
- .compileWithExpectedDiagnostics(
- diagnostics -> {
- if (libraryDesugaringSpecification.hasAnyDesugaring(parameters)) {
- diagnostics.assertOnlyErrors();
- diagnostics.assertErrorsMatch(
- diagnosticType(DesugaredLibraryMismatchDiagnostic.class));
- } else {
- diagnostics.assertNoMessages();
- }
- });
- } catch (CompilationFailedException e) {
- }
+ testForD8()
+ .addProgramFiles(libraryDex)
+ .addProgramFiles(programDex)
+ .setMinApi(parameters.getApiLevel())
+ .compile();
}
@Test
@@ -247,21 +217,11 @@
.compile()
.writeToZip();
- try {
- testForD8()
- .addProgramFiles(libraryDex)
- .addProgramFiles(programDex)
- .setMinApi(parameters.getApiLevel())
- .compileWithExpectedDiagnostics(
- diagnostics -> {
- diagnostics.assertOnlyErrors();
- diagnostics.assertErrorsMatch(
- allOf(
- diagnosticType(DesugaredLibraryMismatchDiagnostic.class),
- diagnosticMessage(containsString("my_group:my_artifact:1.0.9"))));
- });
- } catch (CompilationFailedException e) {
- }
+ testForD8()
+ .addProgramFiles(libraryDex)
+ .addProgramFiles(programDex)
+ .setMinApi(parameters.getApiLevel())
+ .compile();
}
static class Library {}