diff options
author | sebastian.sellmair <sebastian.sellmair@jetbrains.com> | 2020-08-25 14:28:44 +0200 |
---|---|---|
committer | Sebastian Sellmair <34319766+sellmair@users.noreply.github.com> | 2020-08-31 15:10:04 +0200 |
commit | 29cc17ba80018e3e45a5fabcf2e370c735fd5674 (patch) | |
tree | 4845c0d56582c290c69427769a032e8a017c2773 /plugins/base/src/test/kotlin | |
parent | 333091e5c5f896769c3371dd74c87a52ffa9562a (diff) | |
download | dokka-29cc17ba80018e3e45a5fabcf2e370c735fd5674.tar.gz dokka-29cc17ba80018e3e45a5fabcf2e370c735fd5674.tar.bz2 dokka-29cc17ba80018e3e45a5fabcf2e370c735fd5674.zip |
Implement ModuleAndPackageDocumentationReader
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r-- | plugins/base/src/test/kotlin/parsers/ParseModuleAndPackageDocumentationFragmentsTest.kt (renamed from plugins/base/src/test/kotlin/parsers/ParseModuleAndPackageDocFragmentsTest.kt) | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/plugins/base/src/test/kotlin/parsers/ParseModuleAndPackageDocFragmentsTest.kt b/plugins/base/src/test/kotlin/parsers/ParseModuleAndPackageDocumentationFragmentsTest.kt index 49eddaea..5c0a0646 100644 --- a/plugins/base/src/test/kotlin/parsers/ParseModuleAndPackageDocFragmentsTest.kt +++ b/plugins/base/src/test/kotlin/parsers/ParseModuleAndPackageDocumentationFragmentsTest.kt @@ -1,11 +1,8 @@ package parsers -import org.jetbrains.dokka.base.parsers.IllegalModuleAndPackageDocumentation -import org.jetbrains.dokka.base.parsers.ModuleAndPackageDocFragment -import org.jetbrains.dokka.base.parsers.ModuleAndPackageDocFragment.Classifier.Module -import org.jetbrains.dokka.base.parsers.ModuleAndPackageDocFragment.Classifier.Package -import org.jetbrains.dokka.base.parsers.ModuleAndPackageDocumentationSource -import org.jetbrains.dokka.base.parsers.parseModuleAndPackageDocFragments +import org.jetbrains.dokka.base.parsers.moduleAndPackage.* +import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentation.Classifier.Module +import org.jetbrains.dokka.base.parsers.moduleAndPackage.ModuleAndPackageDocumentation.Classifier.Package import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test @@ -13,14 +10,13 @@ import org.junit.jupiter.api.assertThrows import org.junit.jupiter.api.io.TempDir import java.nio.file.Path -class ParseModuleAndPackageDocFragmentsTest { +class ParseModuleAndPackageDocumentationFragmentsTest { @Test fun `basic example`() { - val fragments = parseModuleAndPackageDocFragments( - source( - """ + val source = source( + """ # Module kotlin-demo Module description @@ -32,25 +28,28 @@ class ParseModuleAndPackageDocFragmentsTest { # Package org.jetbrains.kotlin.demo2 Package demo2 description """.trimIndent() - ) ) + val fragments = parseModuleAndPackageDocumentationFragments(source) assertEquals( listOf( - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Module, name = "kotlin-demo", - documentation = "Module description" + documentation = "Module description", + source = source ), - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Package, name = "org.jetbrains.kotlin.demo", - documentation = "Package demo description\n## Level 2 heading\nHeading 2" + documentation = "Package demo description\n## Level 2 heading\nHeading 2", + source = source ), - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Package, name = "org.jetbrains.kotlin.demo2", - documentation = "Package demo2 description" + documentation = "Package demo2 description", + source = source ) ), fragments @@ -60,7 +59,7 @@ class ParseModuleAndPackageDocFragmentsTest { @Test fun `no module name specified fails`() { val exception = assertThrows<IllegalModuleAndPackageDocumentation> { - parseModuleAndPackageDocFragments( + parseModuleAndPackageDocumentationFragments( source( """ # Module @@ -79,7 +78,7 @@ class ParseModuleAndPackageDocFragmentsTest { @Test fun `no package name specified fails`() { val exception = assertThrows<IllegalModuleAndPackageDocumentation> { - parseModuleAndPackageDocFragments( + parseModuleAndPackageDocumentationFragments( source( """ # Package @@ -98,7 +97,7 @@ class ParseModuleAndPackageDocFragmentsTest { @Test fun `white space in module name fails`() { val exception = assertThrows<IllegalModuleAndPackageDocumentation> { - parseModuleAndPackageDocFragments( + parseModuleAndPackageDocumentationFragments( source( """ # Module My Module @@ -116,7 +115,7 @@ class ParseModuleAndPackageDocFragmentsTest { @Test fun `white space in package name fails`() { val exception = assertThrows<IllegalModuleAndPackageDocumentation> { - parseModuleAndPackageDocFragments( + parseModuleAndPackageDocumentationFragments( source( """ # Package my package @@ -133,28 +132,29 @@ class ParseModuleAndPackageDocFragmentsTest { @Test fun `multiple whitespaces are supported in first line`() { - val fragments = parseModuleAndPackageDocFragments( - source( - """ - # Module my-module - My Module - # Package com.my.package - My Package + val source = source( + """ + # Module my-module + My Module + # Package com.my.package + My Package """.trimIndent() - ) ) + val fragments = parseModuleAndPackageDocumentationFragments(source) assertEquals( listOf( - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Module, name = "my-module", - documentation = "My Module" + documentation = "My Module", + source = source ), - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Package, name = "com.my.package", - documentation = "My Package" + documentation = "My Package", + source = source ) ), fragments @@ -175,18 +175,20 @@ class ParseModuleAndPackageDocFragmentsTest { assertEquals( listOf( - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Module, name = "MyModule", - documentation = "D1" + documentation = "D1", + source = ModuleAndPackageDocumentationFile(file) ), - ModuleAndPackageDocFragment( + ModuleAndPackageDocumentationFragment( classifier = Package, name = "com.sample", - documentation = "D2" + documentation = "D2", + source = ModuleAndPackageDocumentationFile(file) ) ), - parseModuleAndPackageDocFragments(file) + parseModuleAndPackageDocumentationFragments(file) ) } |