aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin
diff options
context:
space:
mode:
authorEmber Rose <emberrose@google.com>2022-01-27 05:27:02 -0500
committerGitHub <noreply@github.com>2022-01-27 13:27:02 +0300
commit066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb (patch)
treebaedea544726c3ce703096c511228be91d764191 /plugins/base/src/test/kotlin
parente0a10c24ea7e623137f2ab21522ed0f84bf59814 (diff)
downloaddokka-066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb.tar.gz
dokka-066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb.tar.bz2
dokka-066c551fc6fcb2c60e3ed2014d0ef5e11409f9eb.zip
Collect annotations from package-info.java (#2331)
Fix: #2330
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r--plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt27
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
index 5cbd4416..27a06b77 100644
--- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
+++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt
@@ -3,6 +3,8 @@ package translators
import org.jetbrains.dokka.model.doc.Text
import org.jetbrains.dokka.model.firstMemberOfType
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.links.DRI
+import org.jetbrains.dokka.model.Annotations
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
@@ -166,4 +168,29 @@ class DefaultPsiToDocumentableTranslatorTest : BaseAbstractTest() {
}
}
}
+
+ @Test
+ fun `java package-info package annotations`() {
+ testInline(
+ """
+ |/src/main/java/sample/PackageAnnotation.java
+ |package sample;
+ |@java.lang.annotation.Target(java.lang.annotation.ElementType.PACKAGE)
+ |public @interface PackageAnnotation {
+ |}
+ |
+ |/src/main/java/sample/package-info.java
+ |@PackageAnnotation
+ |package sample;
+ """.trimMargin(),
+ configuration
+ ) {
+ documentablesMergingStage = { module ->
+ assertEquals(
+ Annotations.Annotation(DRI("sample", "PackageAnnotation"), emptyMap()),
+ module.packages.single().extra[Annotations]?.directAnnotations?.values?.single()?.single()
+ )
+ }
+ }
+ }
}