[Tests] Introduce transformers functions object
This commit is contained in:
+3
-2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.runners.codegen;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.runners.TransformersFunctions;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -19291,13 +19292,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
@Test
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "@kotlin.jvm.JvmInline"));
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::replaceOptionalJvmInlineAnnotationWithReal);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.runners.codegen;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.runners.TransformersFunctions;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -18907,7 +18908,7 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
||||
@Test
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "@kotlin.jvm.JvmInline"));
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::replaceOptionalJvmInlineAnnotationWithReal);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+3
-2
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.test.runners.codegen;
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.runners.TransformersFunctions;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -19291,13 +19292,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
@Test
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "@kotlin.jvm.JvmInline"));
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::replaceOptionalJvmInlineAnnotationWithReal);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.test.runners
|
||||
|
||||
object TransformersFunctions {
|
||||
@JvmStatic
|
||||
fun replaceOptionalJvmInlineAnnotationWithReal(source: String): String {
|
||||
return source.replace("OPTIONAL_JVM_INLINE_ANNOTATION", "@JvmInline")
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun removeOptionalJvmInlineAnnotation(source: String): String {
|
||||
return source.replace("OPTIONAL_JVM_INLINE_ANNOTATION", "")
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -124,7 +124,12 @@ private class TestGeneratorImplInstance(
|
||||
p.println("import " + KtTestUtil::class.java.canonicalName + ";")
|
||||
|
||||
for (clazz in testClassModels.flatMapTo(mutableSetOf()) { classModel -> classModel.imports }) {
|
||||
p.println("import ${clazz.name};")
|
||||
val realName = when (clazz) {
|
||||
TransformingTestMethodModel.TransformerFunctionsClassPlaceHolder::class.java ->
|
||||
"org.jetbrains.kotlin.test.runners.TransformersFunctions"
|
||||
else -> clazz.name
|
||||
}
|
||||
p.println("import $realName;")
|
||||
}
|
||||
|
||||
if (suiteClassPackage != baseTestClassPackage) {
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.runners.TransformersFunctions;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -15780,7 +15781,7 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "@kotlin.jvm.JvmInline"));
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::replaceOptionalJvmInlineAnnotationWithReal);
|
||||
}
|
||||
|
||||
@TestMetadata("boxUnboxInlineClassesWithOperatorsGetSet.kt")
|
||||
|
||||
Reference in New Issue
Block a user