[KAPT] Migrate kapt tests to new test infrastructure
This commit is contained in:
committed by
teamcity
parent
fdf1b8b1c0
commit
9c41e75802
+2
-1
@@ -35,7 +35,8 @@ class SimpleDirective(
|
||||
class StringDirective(
|
||||
name: String,
|
||||
description: String,
|
||||
applicability: DirectiveApplicability
|
||||
applicability: DirectiveApplicability,
|
||||
val multiLine: Boolean
|
||||
) : Directive(name, description, applicability)
|
||||
|
||||
class ValueDirective<T : Any>(
|
||||
|
||||
+3
-2
@@ -29,9 +29,10 @@ abstract class SimpleDirectivesContainer : DirectivesContainer() {
|
||||
|
||||
protected fun stringDirective(
|
||||
description: String,
|
||||
applicability: DirectiveApplicability = DirectiveApplicability.Global
|
||||
applicability: DirectiveApplicability = DirectiveApplicability.Global,
|
||||
multiLine: Boolean = false
|
||||
): DirectiveDelegateProvider<StringDirective> {
|
||||
return DirectiveDelegateProvider { StringDirective(it, description, applicability) }
|
||||
return DirectiveDelegateProvider { StringDirective(it, description, applicability, multiLine) }
|
||||
}
|
||||
|
||||
protected inline fun <reified T : Enum<T>> enumDirective(
|
||||
|
||||
+8
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.idea.KotlinLanguage
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.sourceFiles.LightTreeFile
|
||||
import org.jetbrains.kotlin.test.model.TestFile
|
||||
import org.jetbrains.kotlin.test.model.TestModule
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil
|
||||
import org.jetbrains.kotlin.toSourceLinesMapping
|
||||
import java.io.File
|
||||
@@ -142,3 +143,10 @@ val TestFile.isJsFile: Boolean
|
||||
|
||||
val TestFile.isMjsFile: Boolean
|
||||
get() = name.endsWith(".mjs")
|
||||
|
||||
val TestModule.javaFiles: List<TestFile>
|
||||
get() = files.filter { it.isJavaFile }
|
||||
|
||||
fun SourceFileProvider.getRealJavaFiles(module: TestModule): List<File> {
|
||||
return module.javaFiles.map { getRealFileForSourceFile(it) }
|
||||
}
|
||||
|
||||
+1
@@ -10,6 +10,7 @@ import java.io.File
|
||||
abstract class TemporaryDirectoryManager(protected val testServices: TestServices) : TestService {
|
||||
abstract fun getOrCreateTempDirectory(name: String): File
|
||||
abstract fun cleanupTemporaryDirectories()
|
||||
abstract val rootDir: File
|
||||
}
|
||||
|
||||
val TestServices.temporaryDirectoryManager: TemporaryDirectoryManager by TestServices.testServiceAccessor()
|
||||
|
||||
+9
-5
@@ -18,12 +18,13 @@ class RegisteredDirectivesParser(private val container: DirectivesContainer, pri
|
||||
fun parseDirective(line: String): RawDirective? {
|
||||
val result = DIRECTIVE_PATTERN.matchEntire(line)?.groupValues ?: return null
|
||||
val name = result.getOrNull(NAME_GROUP) ?: return null
|
||||
val values = result.getOrNull(VALUES_GROUP)?.split(SPACES_PATTERN)?.filter { it.isNotBlank() }?.takeIf { it.isNotEmpty() }
|
||||
return RawDirective(name, values)
|
||||
val rawValue = result.getOrNull(VALUES_GROUP)
|
||||
val values = rawValue?.split(SPACES_PATTERN)?.filter { it.isNotBlank() }?.takeIf { it.isNotEmpty() }
|
||||
return RawDirective(name, values, rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
data class RawDirective(val name: String, val values: List<String>?)
|
||||
data class RawDirective(val name: String, val values: List<String>?, val rawValue: String?)
|
||||
data class ParsedDirective(val directive: Directive, val values: List<*>)
|
||||
|
||||
private val simpleDirectives = mutableListOf<SimpleDirective>()
|
||||
@@ -58,7 +59,7 @@ class RegisteredDirectivesParser(private val container: DirectivesContainer, pri
|
||||
}
|
||||
|
||||
fun convertToRegisteredDirective(rawDirective: RawDirective): ParsedDirective? {
|
||||
val (name, rawValues) = rawDirective
|
||||
val (name, rawValues, rawValueString) = rawDirective
|
||||
val directive = container[name] ?: return null
|
||||
|
||||
val values: List<*> = when (directive) {
|
||||
@@ -72,7 +73,10 @@ class RegisteredDirectivesParser(private val container: DirectivesContainer, pri
|
||||
}
|
||||
|
||||
is StringDirective -> {
|
||||
rawValues ?: emptyList<Any?>()
|
||||
when (directive.multiLine) {
|
||||
true -> listOfNotNull(rawValueString)
|
||||
false -> rawValues ?: emptyList()
|
||||
}
|
||||
}
|
||||
|
||||
is ValueDirective<*> -> {
|
||||
|
||||
Reference in New Issue
Block a user