From fe25fa541dcc19a169f837e4c1ef76a40b9aa9d8 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Tue, 3 Oct 2023 16:08:04 +0300 Subject: [PATCH] Add new tests for version parsing --- .../deployment/pkg/steps/GraalVMTest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java b/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java index 1eb25af5965c7..9d251f8a48de0 100644 --- a/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java +++ b/core/deployment/src/test/java/io/quarkus/deployment/pkg/steps/GraalVMTest.java @@ -93,6 +93,39 @@ static void assertVersion(Version graalVmVersion, Distribution distro, Version v } } + @Test + public void testGraalVM21VersionParser() { + Version graalVM21Dev = Version.of(Stream.of(("native-image 21 2023-09-19\n" + + "GraalVM Runtime Environment GraalVM CE 21+35.1 (build 21+35-jvmci-23.1-b15)\n" + + "Substrate VM GraalVM CE 21+35.1 (build 21+35, serial gc)").split("\\n"))); + assertThat(graalVM21Dev.distribution.name()).isEqualTo("GRAALVM"); + assertThat(graalVM21Dev.getVersionAsString()).isEqualTo("23.1"); + assertThat(graalVM21Dev.javaFeatureVersion).isEqualTo(21); + assertThat(graalVM21Dev.javaUpdateVersion).isEqualTo(0); + } + + @Test + public void testGraalVM21DevVersionParser() { + Version graalVM21Dev = Version.of(Stream.of(("native-image 21 2023-09-19\n" + + "GraalVM Runtime Environment GraalVM CE 21-dev+35.1 (build 21+35-jvmci-23.1-b14)\n" + + "Substrate VM GraalVM CE 21-dev+35.1 (build 21+35, serial gc)").split("\\n"))); + assertThat(graalVM21Dev.distribution.name()).isEqualTo("GRAALVM"); + assertThat(graalVM21Dev.getVersionAsString()).isEqualTo("23.1-dev"); + assertThat(graalVM21Dev.javaFeatureVersion).isEqualTo(21); + assertThat(graalVM21Dev.javaUpdateVersion).isEqualTo(0); + } + + @Test + public void testGraalVM22DevVersionParser() { + Version graalVM22Dev = Version.of(Stream.of(("native-image 22 2024-03-19\n" + + "GraalVM Runtime Environment GraalVM CE 22-dev+16.1 (build 22+16-jvmci-b01)\n" + + "Substrate VM GraalVM CE 22-dev+16.1 (build 22+16, serial gc)").split("\\n"))); + assertThat(graalVM22Dev.distribution.name()).isEqualTo("GRAALVM"); + assertThat(graalVM22Dev.getVersionAsString()).isEqualTo("24.0-dev"); + assertThat(graalVM22Dev.javaFeatureVersion).isEqualTo(22); + assertThat(graalVM22Dev.javaUpdateVersion).isEqualTo(0); + } + @Test public void testGraalVMVersionsOlderThan() { assertOlderThan("GraalVM Version 19.3.6 CE", "GraalVM Version 20.2.0 (Java Version 11.0.9)");