Tests: improve logic of replacing versions with templates

To slightly reduce the number of test data that needs to be changed when
Kotlin switches to a new language version.
This commit is contained in:
Alexander Udalov
2023-08-11 23:21:40 +02:00
committed by Space Team
parent a58a1a3398
commit 9de6df6104
2 changed files with 8 additions and 10 deletions
@@ -102,11 +102,9 @@ public abstract class AbstractCliTest extends TestCaseWithTmpdir {
.replace(org.jetbrains.kotlin.konan.file.File.Companion.getUserDir().getAbsolutePath(), "$USER_DIR$")
.replace(tmpDirAbsoluteDir, "$TMP_DIR$")
.replaceAll("info: executable production duration: \\d+ms", "info: executable production duration: [time]")
.replace("expected version is " + JvmMetadataVersion.INSTANCE, "expected version is $ABI_VERSION$")
.replace("expected version is " + JsMetadataVersion.INSTANCE, "expected version is $ABI_VERSION$")
.replace("compiler version " + JvmMetadataVersion.INSTANCE, "compiler version $ABI_VERSION$")
.replace("up to " + JvmMetadataVersion.INSTANCE, "up to $ABI_VERSION$")
.replace("up to " + JvmMetadataVersion.INSTANCE_NEXT, "up to $ABI_VERSION_NEXT$")
.replace(" " + JvmMetadataVersion.INSTANCE, " $ABI_VERSION$")
.replace(" " + JsMetadataVersion.INSTANCE, " $ABI_VERSION$")
.replace(" " + JvmMetadataVersion.INSTANCE_NEXT, " $ABI_VERSION_NEXT$")
.replace("\\", "/")
.replace(KotlinCompilerVersion.VERSION, "$VERSION$")
.replace("\n" + Usage.BAT_DELIMITER_CHARACTERS_NOTE + "\n", "")