[FIR-PLUGIN] Add test with meta annotation in plugin
This commit is contained in:
+4
-3
@@ -23,8 +23,9 @@ class AllOpenStatusTransformer(session: FirSession) : FirStatusTransformerExtens
|
|||||||
override val mode: Mode
|
override val mode: Mode
|
||||||
get() = Mode.ALL_IN_ANNOTATED_ELEMENT
|
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>
|
override val metaAnnotations: Set<AnnotationFqn> =
|
||||||
get() = emptySet()
|
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
-1
@@ -1,4 +1,4 @@
|
|||||||
FILE: simple.kt
|
FILE: simpleAnnotation.kt
|
||||||
@R|org/jetbrains/kotlin/fir/allopen/AllOpen|() public open class A : R|kotlin/Any| {
|
@R|org/jetbrains/kotlin/fir/allopen/AllOpen|() public open class A : R|kotlin/Any| {
|
||||||
public constructor(): R|A| {
|
public constructor(): R|A| {
|
||||||
super<R|kotlin/Any|>()
|
super<R|kotlin/Any|>()
|
||||||
+21
-3
@@ -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);
|
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/plugins/allopen-plugin/testData"), Pattern.compile("^(.+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("simple.kt")
|
@TestMetadata("compiler/fir/plugins/allopen-plugin/testData/status")
|
||||||
public void testSimple() throws Exception {
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
runTest("compiler/fir/plugins/allopen-plugin/testData/simple.kt");
|
@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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user