FIR IDE: merge symbol building tests and symbol restoring tests
This commit is contained in:
@@ -1014,37 +1014,24 @@ fun main(args: Array<String>) {
|
||||
model("analysisSession/resolveCall")
|
||||
}
|
||||
|
||||
testClass<AbstractSymbolsByPsiBuildingTest> {
|
||||
model("symbolsByPsi")
|
||||
}
|
||||
|
||||
testClass<AbstractSymbolsByFqNameBuildingTest> {
|
||||
model("symbolsByFqName", extension = "txt")
|
||||
}
|
||||
|
||||
|
||||
testClass<AbstractSymbolByReferenceTest> {
|
||||
model("symbolByReference")
|
||||
}
|
||||
|
||||
testClass<AbstractMemberScopeByFqNameTest> {
|
||||
model("memberScopeByFqName", extension = "txt")
|
||||
model("memberScopeByFqName")
|
||||
}
|
||||
|
||||
testClass<AbstractFileScopeTest> {
|
||||
model("fileScopeTest", extension = "kt")
|
||||
}
|
||||
|
||||
testClass<AbstractSymbolFromSourcePointerRestoreTest> {
|
||||
model("symbolPointer", extension = "kt")
|
||||
testClass<AbstractSymbolByPsiTest> {
|
||||
model("symbols/symbolByPsi")
|
||||
}
|
||||
|
||||
testClass<AbstractSymbolFromLibraryPointerRestoreTest> {
|
||||
model("resoreSymbolFromLibrary")
|
||||
testClass<AbstractSymbolByFqNameTest> {
|
||||
model("symbols/symbolByFqName")
|
||||
}
|
||||
|
||||
testClass<AbstractSymbolByReferencePointerRestoreTest> {
|
||||
model("symbolByReference")
|
||||
testClass<AbstractSymbolByReferenceTest> {
|
||||
model("symbols/symbolByReference")
|
||||
}
|
||||
|
||||
testClass<AbstractMemoryLeakInSymbolsTest> {
|
||||
|
||||
+7
-2
@@ -1,6 +1,10 @@
|
||||
class: kotlin/Int
|
||||
// WITH_RUNTIME
|
||||
// DO_NOT_CHECK_SYMBOL_RESTORE
|
||||
|
||||
// SYMBOLS:
|
||||
// class: kotlin/Int
|
||||
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
annotationClassIds: []
|
||||
@@ -1313,3 +1317,4 @@ KtFirConstructorSymbol:
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: PRIVATE
|
||||
*/
|
||||
+4
-2
@@ -1,6 +1,7 @@
|
||||
class: kotlin/collections/MutableList
|
||||
// class: kotlin/collections/MutableList
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/Boolean
|
||||
annotationClassIds: []
|
||||
@@ -507,3 +508,4 @@ KtFirFunctionSymbol:
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+6
-2
@@ -1,6 +1,9 @@
|
||||
class: java/lang/String
|
||||
// DO_NOT_CHECK_SYMBOL_RESTORE
|
||||
|
||||
// SYMBOLS:
|
||||
// class: java/lang/String
|
||||
|
||||
// RESULT
|
||||
/*
|
||||
KtFirJavaFieldSymbol:
|
||||
annotatedType: [] ft<kotlin/CharArray, kotlin/CharArray?>
|
||||
callableIdIfNonLocal: java.lang.String.value
|
||||
@@ -1470,3 +1473,4 @@ KtFirConstructorSymbol:
|
||||
typeParameters: []
|
||||
valueParameters: [KtFirConstructorValueParameterSymbol(offset), KtFirConstructorValueParameterSymbol(count), KtFirConstructorValueParameterSymbol(value)]
|
||||
visibility: UNKNOWN
|
||||
*/
|
||||
+6
-2
@@ -1,6 +1,9 @@
|
||||
class: kotlin/Function2
|
||||
// WITH_RUNTIME
|
||||
|
||||
// SYMBOLS:
|
||||
// class: kotlin/Function2
|
||||
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] R
|
||||
annotationClassIds: []
|
||||
@@ -84,3 +87,4 @@ KtFirFunctionSymbol:
|
||||
typeParameters: []
|
||||
valueParameters: []
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+6
-2
@@ -1,6 +1,9 @@
|
||||
callable: kotlin/collections/listOf
|
||||
// WITH_RUNTIME
|
||||
|
||||
// SYMBOLS:
|
||||
// callable: kotlin/collections/listOf
|
||||
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/collections/List<T>
|
||||
annotationClassIds: []
|
||||
@@ -63,3 +66,4 @@ KtFirFunctionSymbol:
|
||||
typeParameters: [KtFirTypeParameterSymbol(T)]
|
||||
valueParameters: [KtFirFunctionValueParameterSymbol(elements)]
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+3
-1
@@ -1,6 +1,7 @@
|
||||
class: kotlin/collections/Iterator
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirNamedClassOrObjectSymbol:
|
||||
annotationClassIds: []
|
||||
annotations: []
|
||||
@@ -19,3 +20,4 @@ KtFirNamedClassOrObjectSymbol:
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: [KtFirTypeParameterSymbol(T)]
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+6
-2
@@ -1,6 +1,9 @@
|
||||
class: kotlin/io/FileWalkDirection
|
||||
// WITH_RUNTIME
|
||||
|
||||
// SYMBOLS:
|
||||
// class: kotlin/io/FileWalkDirection
|
||||
|
||||
// RESULT
|
||||
/*
|
||||
KtFirNamedClassOrObjectSymbol:
|
||||
annotationClassIds: []
|
||||
annotations: []
|
||||
@@ -19,3 +22,4 @@ KtFirNamedClassOrObjectSymbol:
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+1
-1
@@ -9,7 +9,7 @@ class X {
|
||||
}
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionValueParameterSymbol:
|
||||
annotatedType: [] kotlin/String
|
||||
+1
-1
@@ -7,7 +7,7 @@ class AnonymousContainer {
|
||||
}
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/Unit
|
||||
+1
-1
@@ -3,7 +3,7 @@ class A {
|
||||
fun x() = 10
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirKotlinPropertySymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
class A<T, R> {
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirTypeParameterSymbol:
|
||||
isReified: false
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun String.foo(): Int = 10
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun foo(x: Int) {}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionValueParameterSymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun <X> foo(x: X) {}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirTypeParameterSymbol:
|
||||
isReified: false
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
fun foo(): Int = 10
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirFunctionSymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun yyy() {
|
||||
class F {}
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirLocalVariableSymbol:
|
||||
annotatedType: [] kotlin/Int
|
||||
+1
-1
@@ -15,7 +15,7 @@ class X : @Anno1 I {
|
||||
val x: @Anno4 I = this
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
// RESULT
|
||||
/*
|
||||
KtFirNamedClassOrObjectSymbol:
|
||||
annotationClassIds: [kotlin/annotation/Target]
|
||||
+1
@@ -1,4 +1,5 @@
|
||||
// WITH_RUNTIME
|
||||
// DO_NOT_CHECK_SYMBOL_RESTORE
|
||||
|
||||
fun x() {
|
||||
val a = <caret>ArrayList(listOf(1))
|
||||
@@ -1,24 +0,0 @@
|
||||
class A {
|
||||
}
|
||||
|
||||
// SYMBOLS:
|
||||
/*
|
||||
KtFirNamedClassOrObjectSymbol:
|
||||
annotationClassIds: []
|
||||
annotations: []
|
||||
classIdIfNonLocal: A
|
||||
classKind: CLASS
|
||||
companionObject: null
|
||||
isData: false
|
||||
isExternal: false
|
||||
isFun: false
|
||||
isInline: false
|
||||
isInner: false
|
||||
modality: FINAL
|
||||
name: A
|
||||
origin: SOURCE
|
||||
superTypes: [[] kotlin/Any]
|
||||
symbolKind: TOP_LEVEL
|
||||
typeParameters: []
|
||||
visibility: PUBLIC
|
||||
*/
|
||||
+8
-5
@@ -6,15 +6,18 @@
|
||||
package org.jetbrains.kotlin.idea.frontend.api.scopes
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.SymbolData
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolsByFqNameBuildingTest
|
||||
import org.jetbrains.kotlin.idea.frontend.api.SymbolByFqName
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.AbstractSymbolByFqNameTest
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestFileStructure
|
||||
|
||||
abstract class AbstractMemberScopeByFqNameTest : AbstractSymbolsByFqNameBuildingTest() {
|
||||
override fun KtAnalysisSession.createSymbols(symbolData: SymbolData): List<KtSymbol> {
|
||||
abstract class AbstractMemberScopeByFqNameTest : AbstractSymbolByFqNameTest() {
|
||||
override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List<KtSymbol> {
|
||||
val symbolData = SymbolByFqName.getSymbolDataFromFile(fileStructure.filePath)
|
||||
val symbols = with(symbolData) { toSymbols() }
|
||||
val classSymbol = symbols.singleOrNull() as? KtClassOrObjectSymbol ?: error("Should be a single class symbol, but $symbols found")
|
||||
val classSymbol = symbols.singleOrNull() as? KtClassOrObjectSymbol
|
||||
?: error("Should be a single class symbol, but $symbols found")
|
||||
return classSymbol.getMemberScope().getAllSymbols().toList()
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -26,26 +26,26 @@ public class MemberScopeByFqNameTestGenerated extends AbstractMemberScopeByFqNam
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInMemberScopeByFqName() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/memberScopeByFqName"), Pattern.compile("^(.+)\\.txt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/memberScopeByFqName"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("Int.txt")
|
||||
@TestMetadata("Int.kt")
|
||||
public void testInt() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt");
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/Int.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("java.lang.String.txt")
|
||||
@TestMetadata("java.lang.String.kt")
|
||||
public void testJava_lang_String() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt");
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kotlin.Function2.txt")
|
||||
@TestMetadata("kotlin.Function2.kt")
|
||||
public void testKotlin_Function2() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/kotlin.Function2.txt");
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/kotlin.Function2.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("MutableList.txt")
|
||||
@TestMetadata("MutableList.kt")
|
||||
public void testMutableList() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt");
|
||||
runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.kt");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -8,9 +8,8 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.SymbolByFqName
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestFileStructure
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
|
||||
abstract class AbstractSymbolFromLibraryPointerRestoreTest : AbstractSymbolPointerRestoreTest() {
|
||||
abstract class AbstractSymbolByFqNameTest : AbstractSymbolTest() {
|
||||
override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List<KtSymbol> {
|
||||
val symbolData = SymbolByFqName.getSymbolDataFromFile(fileStructure.filePath)
|
||||
return with(symbolData) { toSymbols() }
|
||||
+1
-2
@@ -8,10 +8,9 @@ package org.jetbrains.kotlin.idea.frontend.api.symbols
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestFileStructure
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
|
||||
|
||||
abstract class AbstractSymbolFromSourcePointerRestoreTest : AbstractSymbolPointerRestoreTest() {
|
||||
abstract class AbstractSymbolByPsiTest : AbstractSymbolTest() {
|
||||
override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List<KtSymbol> =
|
||||
fileStructure.mainKtFile.collectDescendantsOfType<KtDeclaration>().map { declaration ->
|
||||
declaration.getSymbol()
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestFileStructure
|
||||
import org.jetbrains.kotlin.psi.KtNameReferenceExpression
|
||||
|
||||
abstract class AbstractSymbolByReferencePointerRestoreTest : AbstractSymbolPointerRestoreTest() {
|
||||
override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List<KtSymbol> {
|
||||
val referenceExpression = getElementOfTypeAtCaret<KtNameReferenceExpression>()
|
||||
return listOfNotNull(referenceExpression.mainReference.resolveToSymbol())
|
||||
}
|
||||
}
|
||||
+5
-22
@@ -1,35 +1,18 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2020 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.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.analyseOnPooledThreadInReadAction
|
||||
import org.jetbrains.kotlin.idea.references.KtSimpleNameReference
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.references.mainReference
|
||||
import org.jetbrains.kotlin.idea.test.framework.AbstractKtIdeaTest
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestFileStructure
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestStructureExpectedDataBlock
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestStructureRenderer
|
||||
import org.jetbrains.kotlin.psi.KtNameReferenceExpression
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
|
||||
abstract class AbstractSymbolByReferenceTest : AbstractKtIdeaTest() {
|
||||
override fun doTestByFileStructure(fileStructure: TestFileStructure) {
|
||||
abstract class AbstractSymbolByReferenceTest : AbstractSymbolTest() {
|
||||
override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List<KtSymbol> {
|
||||
val referenceExpression = getElementOfTypeAtCaret<KtNameReferenceExpression>()
|
||||
val reference = referenceExpression.mainReference
|
||||
val renderedSymbol = analyseOnPooledThreadInReadAction(fileStructure.mainKtFile) {
|
||||
val symbol = reference.resolveToSymbol()
|
||||
?: error("${referenceExpression.text} was not resolved to anything")
|
||||
DebugSymbolRenderer.render(symbol)
|
||||
}
|
||||
|
||||
val actual = TestStructureRenderer.render(
|
||||
fileStructure,
|
||||
TestStructureExpectedDataBlock(renderedSymbol),
|
||||
renderingMode = TestStructureRenderer.RenderingMode.ALL_BLOCKS_IN_MULTI_LINE_COMMENT,
|
||||
)
|
||||
KotlinTestUtils.assertEqualsToFile(fileStructure.filePath.toFile(), actual)
|
||||
return listOfNotNull(referenceExpression.mainReference.resolveToSymbol())
|
||||
}
|
||||
}
|
||||
+26
-12
@@ -12,27 +12,40 @@ import com.intellij.psi.PsiDocumentManager
|
||||
import org.jetbrains.kotlin.idea.analyseOnPooledThreadInReadAction
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer
|
||||
import org.jetbrains.kotlin.idea.test.framework.AbstractKtIdeaTest
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestFileStructure
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestStructureExpectedDataBlock
|
||||
import org.jetbrains.kotlin.idea.test.framework.TestStructureRenderer
|
||||
import org.jetbrains.kotlin.idea.test.framework.*
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.KtPsiFactory
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
|
||||
abstract class AbstractSymbolPointerRestoreTest : AbstractKtIdeaTest() {
|
||||
abstract class AbstractSymbolTest : AbstractKtIdeaTest() {
|
||||
abstract fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List<KtSymbol>
|
||||
|
||||
override val allowedDirectives: List<TestFileDirective<*>> = listOf(DIRECTIVES.DO_NOT_CHECK_SYMBOL_RESTORE)
|
||||
|
||||
override fun doTestByFileStructure(fileStructure: TestFileStructure) {
|
||||
val createPointers = !fileStructure.directives.isDirectivePresent(DIRECTIVES.DO_NOT_CHECK_SYMBOL_RESTORE)
|
||||
val pointersWithRendered = analyseOnPooledThreadInReadAction(fileStructure.mainKtFile) {
|
||||
collectSymbols(fileStructure).map { symbol ->
|
||||
PointerWithRenderedSymbol(
|
||||
symbol.createPointer(),
|
||||
if (createPointers) symbol.createPointer() else null,
|
||||
DebugSymbolRenderer.render(symbol)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
compareResults(fileStructure, pointersWithRendered)
|
||||
|
||||
doOutOfBlockModification(fileStructure.mainKtFile)
|
||||
|
||||
if (createPointers) {
|
||||
restoreSymbolsInOtherReadActionAndCompareResults(fileStructure, pointersWithRendered)
|
||||
}
|
||||
}
|
||||
|
||||
private fun compareResults(
|
||||
fileStructure: TestFileStructure,
|
||||
pointersWithRendered: List<PointerWithRenderedSymbol>
|
||||
) {
|
||||
val actual = TestStructureRenderer.render(
|
||||
fileStructure,
|
||||
TestStructureExpectedDataBlock(values = pointersWithRendered.map { it.rendered }),
|
||||
@@ -40,10 +53,6 @@ abstract class AbstractSymbolPointerRestoreTest : AbstractKtIdeaTest() {
|
||||
)
|
||||
|
||||
KotlinTestUtils.assertEqualsToFile(fileStructure.filePath.toFile(), actual)
|
||||
|
||||
doOutOfBlockModification(fileStructure.mainKtFile)
|
||||
|
||||
restoreSymbolsInOtherReadActionAndCompareResults(fileStructure, pointersWithRendered)
|
||||
}
|
||||
|
||||
private fun restoreSymbolsInOtherReadActionAndCompareResults(
|
||||
@@ -52,7 +61,8 @@ abstract class AbstractSymbolPointerRestoreTest : AbstractKtIdeaTest() {
|
||||
) {
|
||||
val restored = analyseOnPooledThreadInReadAction(fileStructure.mainKtFile) {
|
||||
pointersWithRendered.map { (pointer, expectedRender) ->
|
||||
val restored = pointer.restoreSymbol() ?: error("Symbol $expectedRender was not not restored correctly")
|
||||
val restored = pointer!!.restoreSymbol()
|
||||
?: error("Symbol $expectedRender was not not restored")
|
||||
DebugSymbolRenderer.render(restored)
|
||||
}
|
||||
}
|
||||
@@ -83,6 +93,10 @@ abstract class AbstractSymbolPointerRestoreTest : AbstractKtIdeaTest() {
|
||||
private fun commitDocument(document: Document) {
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document)
|
||||
}
|
||||
|
||||
private object DIRECTIVES {
|
||||
val DO_NOT_CHECK_SYMBOL_RESTORE = PresenceDirective("// DO_NOT_CHECK_SYMBOL_RESTORE")
|
||||
}
|
||||
}
|
||||
|
||||
private data class PointerWithRenderedSymbol(val pointer: KtSymbolPointer<*>, val rendered: String)
|
||||
private data class PointerWithRenderedSymbol(val pointer: KtSymbolPointer<*>?, val rendered: String)
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import org.jetbrains.kotlin.idea.frontend.api.AbstractSymbolByFqNameTest
|
||||
import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.SymbolData
|
||||
|
||||
abstract class AbstractSymbolsByFqNameBuildingTest : AbstractSymbolByFqNameTest() {
|
||||
override fun KtAnalysisSession.createSymbols(symbolData: SymbolData): List<KtSymbol> =
|
||||
with(symbolData) { toSymbols() }
|
||||
}
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.kotlin.idea.frontend.api.symbols
|
||||
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import org.jetbrains.kotlin.idea.addExternalTestFiles
|
||||
import org.jetbrains.kotlin.idea.executeOnPooledThreadInReadAction
|
||||
import org.jetbrains.kotlin.idea.frontend.api.analyze
|
||||
import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSession
|
||||
import org.jetbrains.kotlin.idea.frontend.api.getAnalysisSessionFor
|
||||
import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase
|
||||
import org.jetbrains.kotlin.psi.KtDeclaration
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils
|
||||
import java.io.File
|
||||
|
||||
abstract class AbstractSymbolsByPsiBuildingTest : KotlinLightCodeInsightFixtureTestCase() {
|
||||
protected fun doTest(path: String) {
|
||||
addExternalTestFiles(path)
|
||||
val file = File(path)
|
||||
val ktFile = myFixture.configureByText(file.name, FileUtil.loadFile(file)) as KtFile
|
||||
|
||||
val renderedSymbols = executeOnPooledThreadInReadAction {
|
||||
analyze(ktFile) {
|
||||
val declarationSymbols = ktFile.collectDescendantsOfType<KtDeclaration>().map { declaration ->
|
||||
declaration.getSymbol()
|
||||
}
|
||||
declarationSymbols.map(DebugSymbolRenderer::render)
|
||||
}
|
||||
}
|
||||
|
||||
val actual = buildString {
|
||||
val actualSymbolsData = renderedSymbols.joinToString(separator = "\n")
|
||||
val fileTextWithoutSymbolsData = ktFile.text.substringBeforeLast(SYMBOLS_TAG).trimEnd()
|
||||
appendLine(fileTextWithoutSymbolsData)
|
||||
appendLine()
|
||||
appendLine(SYMBOLS_TAG)
|
||||
appendLine("/*")
|
||||
append(actualSymbolsData)
|
||||
appendLine("*/")
|
||||
}
|
||||
KotlinTestUtils.assertEqualsToFile(file, actual)
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SYMBOLS_TAG = "// SYMBOLS:"
|
||||
}
|
||||
}
|
||||
+25
-10
@@ -17,45 +17,60 @@ import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbols/symbolByFqName")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolFromLibraryPointerRestoreTestGenerated extends AbstractSymbolFromLibraryPointerRestoreTest {
|
||||
public class SymbolByFqNameTestGenerated extends AbstractSymbolByFqNameTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInResoreSymbolFromLibrary() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
public void testAllFilesPresentInSymbolByFqName() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbols/symbolByFqName"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary/class.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/class.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classFromJdk.kt")
|
||||
public void testClassFromJdk() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary/classFromJdk.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/classFromJdk.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enumEntry.kt")
|
||||
public void testEnumEntry() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary/enumEntry.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/enumEntry.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("fileWalkDirectionEnum.kt")
|
||||
public void testFileWalkDirectionEnum() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/fileWalkDirectionEnum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterator.kt")
|
||||
public void testIterator() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/iterator.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("listOf.kt")
|
||||
public void testListOf() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/listOf.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunction.kt")
|
||||
public void testMemberFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary/memberFunction.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunctionWithOverloads.kt")
|
||||
public void testMemberFunctionWithOverloads() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary/memberFunctionWithOverloads.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunctionWithOverloads.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nestedClass.kt")
|
||||
public void testNestedClass() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/resoreSymbolFromLibrary/nestedClass.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/nestedClass.kt");
|
||||
}
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* 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.kotlin.idea.frontend.api.symbols;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbols/symbolByPsi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolByPsiTestGenerated extends AbstractSymbolByPsiTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSymbolByPsi() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbols/symbolByPsi"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/annotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObject.kt")
|
||||
public void testAnonymousObject() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/anonymousObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/class.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classMembes.kt")
|
||||
public void testClassMembes() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classMembes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classPrimaryConstructor.kt")
|
||||
public void testClassPrimaryConstructor() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classSecondaryConstructors.kt")
|
||||
public void testClassSecondaryConstructors() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classSecondaryConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classWithTypeParams.kt")
|
||||
public void testClassWithTypeParams() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classWithTypeParams.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/enum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/extensionFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/function.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionWithTypeParams.kt")
|
||||
public void testFunctionWithTypeParams() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/functionWithTypeParams.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitReturn.kt")
|
||||
public void testImplicitReturn() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/implicitReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localDeclarations.kt")
|
||||
public void testLocalDeclarations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/localDeclarations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunctions.kt")
|
||||
public void testMemberFunctions() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperties.kt")
|
||||
public void testMemberProperties() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFunctions.kt")
|
||||
public void testTopLevelFunctions() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelProperties.kt")
|
||||
public void testTopLevelProperties() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAnnotations.kt")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAnnotations.kt");
|
||||
}
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* 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.kotlin.idea.frontend.api.symbols;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbolByReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolByReferencePointerRestoreTestGenerated extends AbstractSymbolByReferencePointerRestoreTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
@TestMetadata("accessorField.kt")
|
||||
public void testAccessorField() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolByReference/accessorField.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSymbolByReference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolByReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorViaTypeAlias.kt")
|
||||
public void testConstructorViaTypeAlias() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolByReference/constructorViaTypeAlias.kt");
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -17,7 +17,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbolByReference")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbols/symbolByReference")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolByReferenceTestGenerated extends AbstractSymbolByReferenceTest {
|
||||
@@ -27,15 +27,15 @@ public class SymbolByReferenceTestGenerated extends AbstractSymbolByReferenceTes
|
||||
|
||||
@TestMetadata("accessorField.kt")
|
||||
public void testAccessorField() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolByReference/accessorField.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByReference/accessorField.kt");
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSymbolByReference() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolByReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbols/symbolByReference"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("constructorViaTypeAlias.kt")
|
||||
public void testConstructorViaTypeAlias() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolByReference/constructorViaTypeAlias.kt");
|
||||
runTest("idea/idea-frontend-fir/testData/symbols/symbolByReference/constructorViaTypeAlias.kt");
|
||||
}
|
||||
}
|
||||
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* 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.kotlin.idea.frontend.api.symbols;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbolPointer")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolFromSourcePointerRestoreTestGenerated extends AbstractSymbolFromSourcePointerRestoreTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSymbolPointer() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolPointer"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/class.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classPrimaryConstructor.kt")
|
||||
public void testClassPrimaryConstructor() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/classPrimaryConstructor.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classSecondaryConstructors.kt")
|
||||
public void testClassSecondaryConstructors() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/classSecondaryConstructors.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("enum.kt")
|
||||
public void testEnum() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/enum.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberFunctions.kt")
|
||||
public void testMemberFunctions() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/memberFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("memberProperties.kt")
|
||||
public void testMemberProperties() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/memberProperties.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelFunctions.kt")
|
||||
public void testTopLevelFunctions() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/topLevelFunctions.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("topLevelProperties.kt")
|
||||
public void testTopLevelProperties() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolPointer/topLevelProperties.kt");
|
||||
}
|
||||
}
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* 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.kotlin.idea.frontend.api.symbols;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbolsByFqName")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolsByFqNameBuildingTestGenerated extends AbstractSymbolsByFqNameBuildingTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSymbolsByFqName() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolsByFqName"), Pattern.compile("^(.+)\\.txt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("fileWalkDirectionEnum.txt")
|
||||
public void testFileWalkDirectionEnum() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByFqName/fileWalkDirectionEnum.txt");
|
||||
}
|
||||
|
||||
@TestMetadata("iterator.txt")
|
||||
public void testIterator() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByFqName/iterator.txt");
|
||||
}
|
||||
|
||||
@TestMetadata("listOf.txt")
|
||||
public void testListOf() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByFqName/listOf.txt");
|
||||
}
|
||||
}
|
||||
-86
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* 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.kotlin.idea.frontend.api.symbols;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.util.KtTestUtil;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("idea/idea-frontend-fir/testData/symbolsByPsi")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class SymbolsByPsiBuildingTestGenerated extends AbstractSymbolsByPsiBuildingTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInSymbolsByPsi() throws Exception {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolsByPsi"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||
}
|
||||
|
||||
@TestMetadata("annotations.kt")
|
||||
public void testAnnotations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/annotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("anonymousObject.kt")
|
||||
public void testAnonymousObject() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/anonymousObject.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("class.kt")
|
||||
public void testClass() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/class.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classMembes.kt")
|
||||
public void testClassMembes() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/classMembes.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("classWithTypeParams.kt")
|
||||
public void testClassWithTypeParams() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/classWithTypeParams.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("extensionFunction.kt")
|
||||
public void testExtensionFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/extensionFunction.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("function.kt")
|
||||
public void testFunction() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/function.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("functionWithTypeParams.kt")
|
||||
public void testFunctionWithTypeParams() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/functionWithTypeParams.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("implicitReturn.kt")
|
||||
public void testImplicitReturn() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/implicitReturn.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("localDeclarations.kt")
|
||||
public void testLocalDeclarations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/localDeclarations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("typeAnnotations.kt")
|
||||
public void testTypeAnnotations() throws Exception {
|
||||
runTest("idea/idea-frontend-fir/testData/symbolsByPsi/typeAnnotations.kt");
|
||||
}
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.kotlin.idea.frontend.api.symbols
|
||||
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* 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.kotlin.idea.test.framework
|
||||
|
||||
import java.util.*
|
||||
|
||||
abstract class TestFileDirective<VALUE : Any> {
|
||||
abstract val name: String
|
||||
abstract fun parse(value: String): VALUE?
|
||||
}
|
||||
|
||||
class PresenceDirective(override val name: String) : TestFileDirective<Boolean>() {
|
||||
override fun parse(value: String): Boolean = true
|
||||
}
|
||||
+3
-4
@@ -36,12 +36,11 @@ class TestFileDirectives(
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
return value as VALUE
|
||||
}
|
||||
|
||||
fun isDirectivePresent(directive: PresenceDirective): Boolean =
|
||||
directive.name in directives
|
||||
}
|
||||
|
||||
abstract class TestFileDirective<VALUE : Any> {
|
||||
abstract val name: String
|
||||
abstract fun parse(value: String): VALUE?
|
||||
}
|
||||
|
||||
sealed class TestFile {
|
||||
abstract val psiFile: PsiFile
|
||||
|
||||
Reference in New Issue
Block a user