[FIR-PLUGIN] Add test with meta annotation in plugin

This commit is contained in:
Dmitriy Novozhilov
2020-04-29 13:08:20 +03:00
parent 343928b97e
commit 2b24317358
6 changed files with 69 additions and 7 deletions
@@ -23,8 +23,9 @@ class AllOpenStatusTransformer(session: FirSession) : FirStatusTransformerExtens
override val mode: Mode
get() = Mode.ALL_IN_ANNOTATED_ELEMENT
override val annotations: Set<AnnotationFqn> = setOf(FqName.fromSegments(listOf("org", "jetbrains", "kotlin", "fir", "allopen", "AllOpen")))
override val annotations: Set<AnnotationFqn> =
setOf(FqName("org.jetbrains.kotlin.fir.allopen.AllOpen"))
override val metaAnnotations: Set<AnnotationFqn>
get() = emptySet()
override val metaAnnotations: Set<AnnotationFqn> =
setOf(FqName("org.jetbrains.kotlin.fir.allopen.AllOpen"))
}
@@ -0,0 +1,18 @@
import org.jetbrains.kotlin.fir.allopen.AllOpen
@Open
class A {
fun foo() {
}
}
@Open
class B : A() {
override fun foo() {
}
}
@AllOpen
annotation class Open
@@ -0,0 +1,25 @@
FILE: metaAnnotation.kt
@R|Open|() public open class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
}
public open fun foo(): R|kotlin/Unit| {
}
}
@R|Open|() public open class B : R|A| {
public constructor(): R|B| {
super<R|A|>()
}
public open override fun foo(): R|kotlin/Unit| {
}
}
@R|org/jetbrains/kotlin/fir/allopen/AllOpen|() public open annotation class Open : R|kotlin/Annotation| {
public constructor(): R|Open| {
super<R|kotlin/Any|>()
}
}
@@ -1,4 +1,4 @@
FILE: simple.kt
FILE: simpleAnnotation.kt
@R|org/jetbrains/kotlin/fir/allopen/AllOpen|() public open class A : R|kotlin/Any| {
public constructor(): R|A| {
super<R|kotlin/Any|>()
@@ -28,8 +28,26 @@ public class FirAllOpenDiagnosticTestGenerated extends AbstractFirAllOpenDiagnos
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/plugins/allopen-plugin/testData"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("simple.kt")
public void testSimple() throws Exception {
runTest("compiler/fir/plugins/allopen-plugin/testData/simple.kt");
@TestMetadata("compiler/fir/plugins/allopen-plugin/testData/status")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Status extends AbstractFirAllOpenDiagnosticTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, this, testDataFilePath);
}
public void testAllFilesPresentInStatus() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/plugins/allopen-plugin/testData/status"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@TestMetadata("metaAnnotation.kt")
public void testMetaAnnotation() throws Exception {
runTest("compiler/fir/plugins/allopen-plugin/testData/status/metaAnnotation.kt");
}
@TestMetadata("simpleAnnotation.kt")
public void testSimpleAnnotation() throws Exception {
runTest("compiler/fir/plugins/allopen-plugin/testData/status/simpleAnnotation.kt");
}
}
}