FIR IDE: add more test cases to file FileStructureTest

This commit is contained in:
Ilya Kirillov
2021-04-09 11:35:40 +02:00
parent fc2bb2e3e6
commit 9c6445d863
8 changed files with 90 additions and 0 deletions
@@ -0,0 +1,11 @@
class A {/* NonReanalyzableDeclarationStructureElement */
val a = run {
class X()
val y = 10
}/* NonReanalyzableDeclarationStructureElement */
}
inline fun <R> run(block: () -> R): R {/* ReanalyzableFunctionStructureElement */
return block()
}
@@ -0,0 +1,13 @@
enum class A {/* NonReanalyzableDeclarationStructureElement */
X,
Y,
Z
;
fun foo(){/* ReanalyzableFunctionStructureElement */}
val x = 10/* NonReanalyzableDeclarationStructureElement */
fun bar() = 10/* NonReanalyzableDeclarationStructureElement */
}
@@ -0,0 +1,13 @@
enum class A {/* NonReanalyzableDeclarationStructureElement */
X {
fun localInX() = 1
},
Y {
override fun foo() {}
},
Z,
;
open fun foo() {/* ReanalyzableFunctionStructureElement */}
}
@@ -0,0 +1,6 @@
class A {/* NonReanalyzableDeclarationStructureElement */
init {
val x = 10
class B
}
}
@@ -0,0 +1,13 @@
var x: Int = 10/* ReanalyzablePropertyStructureElement */
get() = field
set(value) {
field = value
}
class X {/* NonReanalyzableDeclarationStructureElement */
var y: Int = 10/* ReanalyzablePropertyStructureElement */
get() = field
set(value) {
field = value
}
}
@@ -0,0 +1 @@
typealias A = 10/* NonReanalyzableDeclarationStructureElement */
@@ -57,6 +57,9 @@ abstract class AbstractFileStructureTest : KotlinLightCodeInsightFixtureTestCase
ktDeclaration.parent.addAfter(comment, ktDeclaration)
}
}
is KtTypeAlias -> {
ktDeclaration.addAfter(comment, ktDeclaration.getTypeReference())
}
else -> error("Unsupported declaration $ktDeclaration")
}
}
@@ -39,6 +39,26 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt");
}
@TestMetadata("declarationsInPropertyInit.kt")
public void testDeclarationsInPropertyInit() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/declarationsInPropertyInit.kt");
}
@TestMetadata("enumClass.kt")
public void testEnumClass() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClass.kt");
}
@TestMetadata("enumClassWithBody.kt")
public void testEnumClassWithBody() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClassWithBody.kt");
}
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/initBlock.kt");
}
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt");
@@ -59,6 +79,11 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt");
}
@TestMetadata("propertyAccessors.kt")
public void testPropertyAccessors() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/propertyAccessors.kt");
}
@TestMetadata("topLevelExpressionBodyFunWithType.kt")
public void testTopLevelExpressionBodyFunWithType() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt");
@@ -83,4 +108,9 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest {
public void testTopLevelUnitFun() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt");
}
@TestMetadata("typeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/typeAlias.kt");
}
}