[Tests] Regenerate tests with correct postfix
This commit is contained in:
+1
-1
@@ -293,6 +293,6 @@ object NewTestGeneratorImpl : TestGenerator(METHOD_GENERATORS) {
|
|||||||
|
|
||||||
private fun TestClassModel.predefinedNativeTransformers(recursive: Boolean): List<Pair<String, String>> =
|
private fun TestClassModel.predefinedNativeTransformers(recursive: Boolean): List<Pair<String, String>> =
|
||||||
methods.mapNotNull { method ->
|
methods.mapNotNull { method ->
|
||||||
(method as? TransformingTestMethodModel)?.takeIf { it.isNative }?.let { it.source.file.path to it.transformer }
|
(method as? TransformingTestMethodModel)?.takeIf { it.registerInConstructor }?.let { it.source.file.path to it.transformer }
|
||||||
} + if (recursive) innerTestClasses.flatMap { it.predefinedNativeTransformers(recursive) } else listOf()
|
} + if (recursive) innerTestClasses.flatMap { it.predefinedNativeTransformers(recursive) } else listOf()
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -24,8 +24,8 @@ object TransformingTestMethodGenerator : MethodGenerator<TransformingTestMethodM
|
|||||||
override fun generateBody(method: TransformingTestMethodModel, p: Printer) {
|
override fun generateBody(method: TransformingTestMethodModel, p: Printer) {
|
||||||
with(method) {
|
with(method) {
|
||||||
val filePath = KtTestUtil.getFilePath(source.file) + if (source.file.isDirectory) "/" else ""
|
val filePath = KtTestUtil.getFilePath(source.file) + if (source.file.isDirectory) "/" else ""
|
||||||
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\"${if (isNative) "" else ", $transformer"});")
|
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\"${if (registerInConstructor) "" else ", $transformer"});")
|
||||||
if (isNative) {
|
if (registerInConstructor) {
|
||||||
p.println("/*")
|
p.println("/*")
|
||||||
p.println(" There is a registered source transformer for the testcase:")
|
p.println(" There is a registered source transformer for the testcase:")
|
||||||
transformer.lines().forEach { p.println(" $it") }
|
transformer.lines().forEach { p.println(" $it") }
|
||||||
|
|||||||
+2
-3
@@ -21,8 +21,7 @@ abstract class TransformingTestMethodModel(val source: SimpleTestMethodModel, va
|
|||||||
|
|
||||||
override fun imports(): Collection<Class<*>> = super.imports() + TransformerFunctionsClassPlaceHolder::class.java
|
override fun imports(): Collection<Class<*>> = super.imports() + TransformerFunctionsClassPlaceHolder::class.java
|
||||||
|
|
||||||
internal val isNative
|
internal val registerInConstructor
|
||||||
get() = source.targetBackend in listOf(TargetBackend.NATIVE, TargetBackend.ANY)
|
get() = source.targetBackend == TargetBackend.NATIVE
|
||||||
// Native tests load sources before runTest call if more than 1 test is called, so we need to register it before.
|
// Native tests load sources before runTest call if more than 1 test is called, so we need to register it before.
|
||||||
// Existing native tests specify target backend as ANY, setting it to NATIVE removes some previously generated tests.
|
|
||||||
}
|
}
|
||||||
+3
-2
@@ -7,11 +7,12 @@ package org.jetbrains.kotlin.generators.model
|
|||||||
|
|
||||||
class WithoutJvmInlineTestMethodModel(
|
class WithoutJvmInlineTestMethodModel(
|
||||||
source: SimpleTestMethodModel,
|
source: SimpleTestMethodModel,
|
||||||
val withAnnotation: Boolean
|
withAnnotation: Boolean,
|
||||||
|
withPostfix: Boolean,
|
||||||
) : TransformingTestMethodModel(
|
) : TransformingTestMethodModel(
|
||||||
source,
|
source,
|
||||||
transformer = "TransformersFunctions::" +
|
transformer = "TransformersFunctions::" +
|
||||||
if (withAnnotation) "replaceOptionalJvmInlineAnnotationWithReal" else "removeOptionalJvmInlineAnnotation"
|
if (withAnnotation) "replaceOptionalJvmInlineAnnotationWithReal" else "removeOptionalJvmInlineAnnotation"
|
||||||
) {
|
) {
|
||||||
override val name: String = source.name + if (withAnnotation) "" else "_valueClasses"
|
override val name: String = source.name + if (withPostfix) "_valueClasses" else ""
|
||||||
}
|
}
|
||||||
+5
-5
@@ -37,11 +37,11 @@ fun methodModelLocator(
|
|||||||
tags
|
tags
|
||||||
).let { methodModel ->
|
).let { methodModel ->
|
||||||
if (methodModel.containsWithoutJvmInline()) {
|
if (methodModel.containsWithoutJvmInline()) {
|
||||||
val isWithoutAnnotations = when {
|
val isWithAnnotationAndIsWithPostfix = when {
|
||||||
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM_IR) -> listOf(true, false)
|
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM_IR) -> listOf(true to false, false to true)
|
||||||
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(true)
|
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(true to false)
|
||||||
else -> listOf(false)
|
else -> listOf(false to false)
|
||||||
}
|
}
|
||||||
isWithoutAnnotations.map { WithoutJvmInlineTestMethodModel(methodModel, it) }
|
isWithAnnotationAndIsWithPostfix.map { (ann, post) -> WithoutJvmInlineTestMethodModel(methodModel, ann, post) }
|
||||||
} else listOf(methodModel)
|
} else listOf(methodModel)
|
||||||
}
|
}
|
||||||
+1
-1
@@ -14841,7 +14841,7 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14805,7 +14805,7 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -12472,7 +12472,7 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-3
@@ -10,6 +10,7 @@ import org.jetbrains.kotlin.test.util.KtTestUtil;
|
|||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.NativeBlackBoxTestCaseGroupProvider;
|
import org.jetbrains.kotlin.konan.blackboxtest.support.group.NativeBlackBoxTestCaseGroupProvider;
|
||||||
import org.jetbrains.kotlin.konan.blackboxtest.support.group.ExtTestCaseGroupProvider;
|
import org.jetbrains.kotlin.konan.blackboxtest.support.group.ExtTestCaseGroupProvider;
|
||||||
import org.jetbrains.kotlin.test.TargetBackend;
|
import org.jetbrains.kotlin.test.TargetBackend;
|
||||||
|
import org.jetbrains.kotlin.test.runners.TransformersFunctions;
|
||||||
import org.jetbrains.kotlin.test.TestMetadata;
|
import org.jetbrains.kotlin.test.TestMetadata;
|
||||||
import org.junit.jupiter.api.Nested;
|
import org.junit.jupiter.api.Nested;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@@ -15645,7 +15646,7 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
|
|||||||
@NativeBlackBoxTestCaseGroupProvider(ExtTestCaseGroupProvider.class)
|
@NativeBlackBoxTestCaseGroupProvider(ExtTestCaseGroupProvider.class)
|
||||||
public class InlineClasses {
|
public class InlineClasses {
|
||||||
public InlineClasses() {
|
public InlineClasses() {
|
||||||
register("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
register("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", TransformersFunctions::removeOptionalJvmInlineAnnotation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -15703,11 +15704,11 @@ public class NativeExtBlackBoxTestGenerated extends AbstractNativeBlackBoxTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt");
|
||||||
/*
|
/*
|
||||||
There is a registered source transformer for the testcase:
|
There is a registered source transformer for the testcase:
|
||||||
s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "")
|
TransformersFunctions::removeOptionalJvmInlineAnnotation
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user