FIR UAST: refactor FE1 UAST tests
This commit is contained in:
committed by
Ilya Kirillov
parent
e1a99ede09
commit
ce10410aba
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* 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.uast.test.env.kotlin
|
||||||
|
|
||||||
|
import org.jetbrains.uast.UFile
|
||||||
|
import org.jetbrains.uast.test.kotlin.AbstractKotlinUastTest
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
abstract class AbstractFE1UastTest : AbstractKotlinUastTest() {
|
||||||
|
override var testDataDir = File("plugins/uast-kotlin-fir/testData")
|
||||||
|
|
||||||
|
fun doTest(filePath: String) {
|
||||||
|
testDataDir = File(filePath).parentFile
|
||||||
|
val testName = File(filePath).nameWithoutExtension
|
||||||
|
val virtualFile = getVirtualFile(testName)
|
||||||
|
|
||||||
|
val psiFile = psiManager.findFile(virtualFile) ?: error("Can't get psi file for $testName")
|
||||||
|
val uFile = uastContext.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName")
|
||||||
|
check(filePath, uFile as UFile)
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-14
@@ -7,24 +7,12 @@ package org.jetbrains.uast.test.kotlin
|
|||||||
|
|
||||||
import org.jetbrains.uast.UFile
|
import org.jetbrains.uast.UFile
|
||||||
import org.jetbrains.uast.test.common.kotlin.FirUastRenderLogTestBase
|
import org.jetbrains.uast.test.common.kotlin.FirUastRenderLogTestBase
|
||||||
import java.io.File
|
import org.jetbrains.uast.test.env.kotlin.AbstractFE1UastTest
|
||||||
|
|
||||||
abstract class AbstractFE1UastDeclarationTest : AbstractKotlinUastTest(), FirUastRenderLogTestBase {
|
abstract class AbstractFE1UastDeclarationTest : AbstractFE1UastTest(), FirUastRenderLogTestBase {
|
||||||
override val isFirUastPlugin: Boolean = false
|
override val isFirUastPlugin: Boolean = false
|
||||||
|
|
||||||
override fun check(filePath: String, file: UFile) {
|
override fun check(filePath: String, file: UFile) {
|
||||||
super<FirUastRenderLogTestBase>.check(filePath, file)
|
super<FirUastRenderLogTestBase>.check(filePath, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var testDataDir = File("plugins/uast-kotlin-fir/testData")
|
|
||||||
|
|
||||||
fun doTest(filePath: String) {
|
|
||||||
testDataDir = File(filePath).parentFile
|
|
||||||
val testName = filePath.substring(filePath.lastIndexOf('/') + 1).removeSuffix(".kt")
|
|
||||||
val virtualFile = getVirtualFile(testName)
|
|
||||||
|
|
||||||
val psiFile = psiManager.findFile(virtualFile) ?: error("Can't get psi file for $testName")
|
|
||||||
val uFile = uastContext.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName")
|
|
||||||
check(filePath, uFile as UFile)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-14
@@ -7,24 +7,12 @@ package org.jetbrains.uast.test.kotlin
|
|||||||
|
|
||||||
import org.jetbrains.uast.UFile
|
import org.jetbrains.uast.UFile
|
||||||
import org.jetbrains.uast.test.common.kotlin.FirUastIdentifiersTestBase
|
import org.jetbrains.uast.test.common.kotlin.FirUastIdentifiersTestBase
|
||||||
import java.io.File
|
import org.jetbrains.uast.test.env.kotlin.AbstractFE1UastTest
|
||||||
|
|
||||||
abstract class AbstractFE1UastIdentifiersTest : AbstractKotlinUastTest(), FirUastIdentifiersTestBase {
|
abstract class AbstractFE1UastIdentifiersTest : AbstractFE1UastTest(), FirUastIdentifiersTestBase {
|
||||||
override val isFirUastPlugin: Boolean = false
|
override val isFirUastPlugin: Boolean = false
|
||||||
|
|
||||||
override fun check(filePath: String, file: UFile) {
|
override fun check(filePath: String, file: UFile) {
|
||||||
super<FirUastIdentifiersTestBase>.check(filePath, file)
|
super<FirUastIdentifiersTestBase>.check(filePath, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var testDataDir = File("plugins/uast-kotlin-fir/testData")
|
|
||||||
|
|
||||||
fun doTest(filePath: String) {
|
|
||||||
testDataDir = File(filePath).parentFile
|
|
||||||
val testName = File(filePath).nameWithoutExtension
|
|
||||||
val virtualFile = getVirtualFile(testName)
|
|
||||||
|
|
||||||
val psiFile = psiManager.findFile(virtualFile) ?: error("Can't get psi file for $testName")
|
|
||||||
val uFile = uastContext.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName")
|
|
||||||
check(filePath, uFile as UFile)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-14
@@ -7,24 +7,12 @@ package org.jetbrains.uast.test.kotlin
|
|||||||
|
|
||||||
import org.jetbrains.uast.UFile
|
import org.jetbrains.uast.UFile
|
||||||
import org.jetbrains.uast.test.common.kotlin.FirUastTypesTestBase
|
import org.jetbrains.uast.test.common.kotlin.FirUastTypesTestBase
|
||||||
import java.io.File
|
import org.jetbrains.uast.test.env.kotlin.AbstractFE1UastTest
|
||||||
|
|
||||||
abstract class AbstractFE1UastTypesTest : AbstractKotlinUastTest(), FirUastTypesTestBase {
|
abstract class AbstractFE1UastTypesTest : AbstractFE1UastTest(), FirUastTypesTestBase {
|
||||||
override val isFirUastPlugin: Boolean = false
|
override val isFirUastPlugin: Boolean = false
|
||||||
|
|
||||||
override fun check(filePath: String, file: UFile) {
|
override fun check(filePath: String, file: UFile) {
|
||||||
super<FirUastTypesTestBase>.check(filePath, file)
|
super<FirUastTypesTestBase>.check(filePath, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var testDataDir = File("plugins/uast-kotlin-fir/testData")
|
|
||||||
|
|
||||||
fun doTest(filePath: String) {
|
|
||||||
testDataDir = File(filePath).parentFile
|
|
||||||
val testName = File(filePath).nameWithoutExtension
|
|
||||||
val virtualFile = getVirtualFile(testName)
|
|
||||||
|
|
||||||
val psiFile = psiManager.findFile(virtualFile) ?: error("Can't get psi file for $testName")
|
|
||||||
val uFile = uastContext.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName")
|
|
||||||
check(filePath, uFile as UFile)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-14
@@ -7,24 +7,12 @@ package org.jetbrains.uast.test.kotlin
|
|||||||
|
|
||||||
import org.jetbrains.uast.UFile
|
import org.jetbrains.uast.UFile
|
||||||
import org.jetbrains.uast.test.common.kotlin.FirUastValuesTestBase
|
import org.jetbrains.uast.test.common.kotlin.FirUastValuesTestBase
|
||||||
import java.io.File
|
import org.jetbrains.uast.test.env.kotlin.AbstractFE1UastTest
|
||||||
|
|
||||||
abstract class AbstractFE1UastValuesTest : AbstractKotlinUastTest(), FirUastValuesTestBase {
|
abstract class AbstractFE1UastValuesTest : AbstractFE1UastTest(), FirUastValuesTestBase {
|
||||||
override val isFirUastPlugin: Boolean = false
|
override val isFirUastPlugin: Boolean = false
|
||||||
|
|
||||||
override fun check(filePath: String, file: UFile) {
|
override fun check(filePath: String, file: UFile) {
|
||||||
super<FirUastValuesTestBase>.check(filePath, file)
|
super<FirUastValuesTestBase>.check(filePath, file)
|
||||||
}
|
}
|
||||||
|
|
||||||
override var testDataDir = File("plugins/uast-kotlin-fir/testData")
|
|
||||||
|
|
||||||
fun doTest(filePath: String) {
|
|
||||||
testDataDir = File(filePath).parentFile
|
|
||||||
val testName = filePath.substring(filePath.lastIndexOf('/') + 1).removeSuffix(".kt")
|
|
||||||
val virtualFile = getVirtualFile(testName)
|
|
||||||
|
|
||||||
val psiFile = psiManager.findFile(virtualFile) ?: error("Can't get psi file for $testName")
|
|
||||||
val uFile = uastContext.convertElementWithParent(psiFile, null) ?: error("Can't get UFile for $testName")
|
|
||||||
check(filePath, uFile as UFile)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user