[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>> =
|
||||
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()
|
||||
}
|
||||
|
||||
+2
-2
@@ -24,8 +24,8 @@ object TransformingTestMethodGenerator : MethodGenerator<TransformingTestMethodM
|
||||
override fun generateBody(method: TransformingTestMethodModel, p: Printer) {
|
||||
with(method) {
|
||||
val filePath = KtTestUtil.getFilePath(source.file) + if (source.file.isDirectory) "/" else ""
|
||||
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\"${if (isNative) "" else ", $transformer"});")
|
||||
if (isNative) {
|
||||
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\"${if (registerInConstructor) "" else ", $transformer"});")
|
||||
if (registerInConstructor) {
|
||||
p.println("/*")
|
||||
p.println(" There is a registered source transformer for the testcase:")
|
||||
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
|
||||
|
||||
internal val isNative
|
||||
get() = source.targetBackend in listOf(TargetBackend.NATIVE, TargetBackend.ANY)
|
||||
internal val registerInConstructor
|
||||
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.
|
||||
// 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(
|
||||
source: SimpleTestMethodModel,
|
||||
val withAnnotation: Boolean
|
||||
withAnnotation: Boolean,
|
||||
withPostfix: Boolean,
|
||||
) : TransformingTestMethodModel(
|
||||
source,
|
||||
transformer = "TransformersFunctions::" +
|
||||
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
|
||||
).let { methodModel ->
|
||||
if (methodModel.containsWithoutJvmInline()) {
|
||||
val isWithoutAnnotations = when {
|
||||
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM_IR) -> listOf(true, false)
|
||||
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(true)
|
||||
else -> listOf(false)
|
||||
val isWithAnnotationAndIsWithPostfix = when {
|
||||
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM_IR) -> listOf(true to false, false to true)
|
||||
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(true to false)
|
||||
else -> listOf(false to false)
|
||||
}
|
||||
isWithoutAnnotations.map { WithoutJvmInlineTestMethodModel(methodModel, it) }
|
||||
isWithAnnotationAndIsWithPostfix.map { (ann, post) -> WithoutJvmInlineTestMethodModel(methodModel, ann, post) }
|
||||
} else listOf(methodModel)
|
||||
}
|
||||
Reference in New Issue
Block a user