More expectation updatea
* One to a Java 21 test
* One to run some Jasmin tests on JDK-17
Change-Id: I6a47be753a7d09ce81a8a20c7e32602901dc8c91
diff --git a/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethod.java b/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethod.java
index a8b9366..aa6d288 100644
--- a/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethod.java
+++ b/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethod.java
@@ -42,6 +42,16 @@
"Trumps or Atouts",
"The Fool or L'Excuse");
+ public static String EXPECTED_OUTPUT_ASCII =
+ StringUtils.lines(
+ "null",
+ "Spades or Piques",
+ "Hearts or Coeur",
+ "Diamonds or Carreaux",
+ "Clubs or Trefles",
+ "Trumps or Atouts",
+ "The Fool or L'Excuse");
+
@Test
public void testJvm() throws Exception {
assumeTrue(parameters.isCfRuntime());
@@ -64,8 +74,9 @@
testForD8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.setMinApi(parameters)
- .run(parameters.getRuntime(), Main.class)
- .assertSuccessWithOutput(EXPECTED_OUTPUT);
+ // Windows does not like the non ascii characters.
+ .run(parameters.getRuntime(), Main.class, ToolHelper.isWindows() ? "ascii" : "")
+ .assertSuccessWithOutput(ToolHelper.isWindows() ? EXPECTED_OUTPUT_ASCII : EXPECTED_OUTPUT);
}
@Test
@@ -96,8 +107,10 @@
}
public static class Main {
+ static boolean ascii = false;
public static void main(String[] args) {
+ ascii = args.length > 0 && args[0].equals("ascii");
enumSwitch(null);
enumSwitch(Tarot.SPADE);
enumSwitch(Tarot.HEART);
@@ -111,7 +124,7 @@
switch (t1) {
case null -> System.out.println("null");
case SPADE -> System.out.println("Spades or Piques");
- case HEART -> System.out.println("Hearts or C\u0153ur");
+ case HEART -> System.out.println(ascii ? "Hearts or Coeur" : "Hearts or C\u0153ur");
case Tarot t when t == Tarot.DIAMOND -> System.out.println("Diamonds or Carreaux");
case Tarot t when t == Tarot.CLUB -> System.out.println("Clubs or Trefles");
case Tarot t when t == Tarot.TRUMP -> System.out.println("Trumps or Atouts");
diff --git a/src/test/testbase/java/com/android/tools/r8/jasmin/JasminTestBase.java b/src/test/testbase/java/com/android/tools/r8/jasmin/JasminTestBase.java
index 899696d..1f48a2b 100644
--- a/src/test/testbase/java/com/android/tools/r8/jasmin/JasminTestBase.java
+++ b/src/test/testbase/java/com/android/tools/r8/jasmin/JasminTestBase.java
@@ -8,6 +8,7 @@
import com.android.tools.r8.OutputMode;
import com.android.tools.r8.R8Command;
import com.android.tools.r8.TestBase;
+import com.android.tools.r8.TestRuntime.CfRuntime;
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.ToolHelper.ProcessResult;
import com.android.tools.r8.graph.DexEncodedMethod;
@@ -29,7 +30,9 @@
protected ProcessResult runOnJavaRaw(JasminBuilder builder, String main) throws Exception {
Path out = temp.newFolder().toPath();
builder.writeClassFiles(out);
- return ToolHelper.runJava(out, main);
+ // Run the code on the JVM from JDK-17, as at least one test in test InvalidClassNames will
+ // fail with a LinkageError and exit code != 0 for some invalid class names tested (a/b/c/a/D/).
+ return ToolHelper.runJava(CfRuntime.getCheckedInJdk17(), ImmutableList.of(out), main);
}
protected ProcessResult runOnJavaNoVerifyRaw(JasminBuilder builder, String main)