[Tests] Replace @JvmInline with actual OPTIONAL_JVM_INLINE_ANNOTATION
This commit is contained in:
+2
-1
@@ -24,7 +24,8 @@ object WithoutJvmInlineTestMethodGenerator : MethodGenerator<WithoutJvmInlineTes
|
||||
override fun generateBody(method: WithoutJvmInlineTestMethodModel, p: Printer) {
|
||||
with(method) {
|
||||
val filePath = KtTestUtil.getFilePath(source.file) + if (source.file.isDirectory) "/" else ""
|
||||
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\", s -> s.replaceAll(\"@(kotlin.jvm.)?JvmInline\", \"\"));")
|
||||
val replacement = if (method.withAnnotation) "@kotlin.jvm.JvmInline" else ""
|
||||
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\", s -> s.replaceAll(\"OPTIONAL_JVM_INLINE_ANNOTATION\", \"$replacement\"));")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -6,14 +6,15 @@
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
class WithoutJvmInlineTestMethodModel(
|
||||
val source: SimpleTestMethodModel
|
||||
val source: SimpleTestMethodModel,
|
||||
val withAnnotation: Boolean
|
||||
) : MethodModel {
|
||||
object Kind : MethodModel.Kind()
|
||||
|
||||
override val kind: MethodModel.Kind
|
||||
get() = Kind
|
||||
override val name: String
|
||||
get() = "${source.name}WithoutJvmInlineAnnotation"
|
||||
get() = source.name + if (withAnnotation) "" else "_valueClasses"
|
||||
override val dataString: String
|
||||
get() = source.dataString
|
||||
override val tags: List<String>
|
||||
|
||||
+3
-2
@@ -12,7 +12,7 @@ import java.util.regex.Pattern
|
||||
|
||||
fun TestEntityModel.containsWithoutJvmInline(backend: TargetBackend): Boolean = backend == TargetBackend.JVM_IR && when (this) {
|
||||
is ClassModel -> methods.any { it.containsWithoutJvmInline(backend) } || innerTestClasses.any { it.containsWithoutJvmInline(backend) }
|
||||
is SimpleTestMethodModel -> file.readLines().any { Regex("^\\s*//\\s*WORKS_WITHOUT_JVM_INLINE\\s*$").matches(it) }
|
||||
is SimpleTestMethodModel -> file.readLines().any { Regex("^\\s*//\\s*WORKS_WHEN_VALUE_CLASS\\s*$").matches(it) }
|
||||
else -> false
|
||||
}
|
||||
|
||||
@@ -33,5 +33,6 @@ fun methodModelLocator(
|
||||
skipIgnored,
|
||||
tags
|
||||
).let { methodModel ->
|
||||
listOf(methodModel) + if (methodModel.containsWithoutJvmInline(targetBackend)) listOf(WithoutJvmInlineTestMethodModel(methodModel)) else emptyList()
|
||||
if (methodModel.containsWithoutJvmInline(targetBackend)) listOf(true, false).map { WithoutJvmInlineTestMethodModel(methodModel, it) }
|
||||
else listOf(methodModel)
|
||||
}
|
||||
Reference in New Issue
Block a user