diff options
Diffstat (limited to 'plugins/base/src/test/kotlin/translators')
-rw-r--r-- | plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt | 71 |
1 files changed, 60 insertions, 11 deletions
diff --git a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt index eb682b14..5d3f7398 100644 --- a/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt +++ b/plugins/base/src/test/kotlin/translators/DefaultPsiToDocumentableTranslatorTest.kt @@ -1,9 +1,9 @@ package translators -import org.jetbrains.dokka.model.DModule -import org.jetbrains.dokka.model.doc.Description import org.jetbrains.dokka.model.doc.Text +import org.jetbrains.dokka.model.firstMemberOfType import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest +import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test @@ -22,21 +22,21 @@ class DefaultPsiToDocumentableTranslatorTest : AbstractCoreTest() { testInline( """ |/src/main/java/sample/BaseClass1.java - |package sample + |package sample; |public class BaseClass1 { | /** B1 */ | void x() { } |} | |/src/main/java/sample/BaseClass2.java - |package sample + |package sample; |public class BaseClass2 extends BaseClass1 { | /** B2 */ | void x() { } |} | |/src/main/java/sample/X.java - |package sample + |package sample; |public class X extends BaseClass2 { | void x() { } |} @@ -67,21 +67,21 @@ class DefaultPsiToDocumentableTranslatorTest : AbstractCoreTest() { testInline( """ |/src/main/java/sample/BaseClass1.java - |package sample + |package sample; |public class BaseClass1 { | /** B1 */ | void x() { } |} | |/src/main/java/sample/Interface1.java - |package sample + |package sample; |public interface Interface1 { | /** I1 */ | void x() {} |} | |/src/main/java/sample/X.java - |package sample + |package sample; |public class X extends BaseClass1 implements Interface1 { | void x() { } |} @@ -112,20 +112,20 @@ class DefaultPsiToDocumentableTranslatorTest : AbstractCoreTest() { testInline( """ |/src/main/java/sample/BaseClass1.java - |package sample + |package sample; |public class BaseClass1 { | /** B1 */ | void x() { } |} | |/src/main/java/sample/BaseClass2.java - |package sample + |package sample; |public class BaseClass2 extends BaseClass1 { | void x() {} |} | |/src/main/java/sample/X.java - |package sample + |package sample; |public class X extends BaseClass2 { | void x() { } |} @@ -141,4 +141,53 @@ class DefaultPsiToDocumentableTranslatorTest : AbstractCoreTest() { } } } + + @Test + fun `java package-info package description`() { + val configuration = dokkaConfiguration { + sourceSets { + sourceSet { + sourceRoots = listOf("src/main/java") + } + } + } + + testInline( + """ + |/src/main/java/sample/BaseClass1.java + |package sample; + |public class BaseClass1 { + | /** B1 */ + | void x() { } + |} + | + |/src/main/java/sample/BaseClass2.java + |package sample; + |public class BaseClass2 extends BaseClass1 { + | void x() {} + |} + | + |/src/main/java/sample/X.java + |package sample; + |public class X extends BaseClass2 { + | void x() { } + |} + | + |/src/main/java/sample/package-info.java + |/** + | * Here comes description from package-info + | */ + |package sample; + """.trimMargin(), + configuration + ) { + documentablesMergingStage = { module -> + val documentationOfPackage = module.packages.single().documentation.values.single().children.single() + .firstMemberOfType<Text>().body + assertEquals( + "Here comes description from package-info", documentationOfPackage + ) + } + } + } } |