diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-06-19 14:08:49 +0200 |
---|---|---|
committer | Paweł Marks <pmarks@virtuslab.com> | 2020-06-25 20:23:58 +0200 |
commit | 8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f (patch) | |
tree | fe4e24d9f352199e551bd34ba330c0d2c0acf7af /plugins/base/src/test/kotlin | |
parent | 08f40e2a13006882e8f8425f111b8527e7bbcb0f (diff) | |
download | dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.gz dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.tar.bz2 dokka-8cb6efc97f8fa321381c95cc5f85a3ce7bc13c3f.zip |
Remove SourceSetDataCache, rename PassConfiguration to DokkaSourceSet and use it instead of SourceSetData
Diffstat (limited to 'plugins/base/src/test/kotlin')
6 files changed, 88 insertions, 29 deletions
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt index f66f88db..2e05d241 100644 --- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt +++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt @@ -3,8 +3,6 @@ package content.params import matchers.content.* import org.jetbrains.dokka.Platform import org.jetbrains.dokka.model.DFunction -import org.jetbrains.dokka.model.Documentable -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.model.doc.DocumentationNode import org.jetbrains.dokka.model.doc.Param import org.jetbrains.dokka.model.doc.Text @@ -570,7 +568,7 @@ class ContentForParamsTest : AbstractCoreTest() { } @Test - fun javaDocCommentWithDocumentedParameters(){ + fun javaDocCommentWithDocumentedParameters() { testInline( """ |/src/main/java/test/Main.java @@ -587,14 +585,14 @@ class ContentForParamsTest : AbstractCoreTest() { | } | } """.trimIndent(), testConfiguration - ){ - pagesTransformationStage = { - module -> + ) { + pagesTransformationStage = { module -> val sampleFunction = module.dfs { - it is MemberPageNode && it.dri.first().toString() == "test/Main/sample/#java.lang.String#java.lang.String/PointingToDeclaration/" + it is MemberPageNode && it.dri.first() + .toString() == "test/Main/sample/#java.lang.String#java.lang.String/PointingToDeclaration/" } as MemberPageNode val forJvm = (sampleFunction.documentable as DFunction).parameters.mapNotNull { - val jvm = it.documentation.keys.first { it.platform == Platform.jvm } + val jvm = it.documentation.keys.first { it.analysisPlatform == Platform.jvm } it.documentation[jvm] } diff --git a/plugins/base/src/test/kotlin/model/InheritorsTest.kt b/plugins/base/src/test/kotlin/model/InheritorsTest.kt index 5daebb73..f5517abb 100644 --- a/plugins/base/src/test/kotlin/model/InheritorsTest.kt +++ b/plugins/base/src/test/kotlin/model/InheritorsTest.kt @@ -31,7 +31,7 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt", ) { with((this / "inheritors" / "A").cast<DInterface>()) { val map = extra[InheritorsInfo].assertNotNull("InheritorsInfo").value - with(map.keys.also { it counts 1 }.find { it.platform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! } + with(map.keys.also { it counts 1 }.find { it.analysisPlatform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! } ) { this counts 1 first().classNames equals "B" @@ -77,11 +77,11 @@ class InheritorsTest : AbstractModelTest("/src/main/kotlin/inheritors/Test.kt", with((m / "inheritors" / "A").cast<DInterface>()) { val map = extra[InheritorsInfo].assertNotNull("InheritorsInfo").value with(map.keys.also { it counts 2 }) { - with(find { it.platform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }) { + with(find { it.analysisPlatform == Platform.jvm }.assertNotNull("jvm key").let { map[it]!! }) { this counts 1 first().classNames equals "B" } - with(find { it.platform == Platform.js }.assertNotNull("js key").let { map[it]!! }) { + with(find { it.analysisPlatform == Platform.js }.assertNotNull("js key").let { map[it]!! }) { this counts 2 val classes = listOf("B", "C") assertTrue(all { classes.contains(it.classNames) }, "One of subclasses missing in js" ) diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt index 452439e9..21a70802 100644 --- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt +++ b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt @@ -1,21 +1,17 @@ package renderers +import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet import org.jetbrains.dokka.DokkaConfigurationImpl import org.jetbrains.dokka.base.DokkaBase import org.jetbrains.dokka.base.renderers.RootCreator import org.jetbrains.dokka.base.resolvers.external.DokkaExternalLocationProviderFactory import org.jetbrains.dokka.base.resolvers.external.JavadocExternalLocationProviderFactory import org.jetbrains.dokka.base.resolvers.local.DefaultLocationProviderFactory -import org.jetbrains.dokka.base.resolvers.local.LocationProvider -import org.jetbrains.dokka.base.resolvers.local.LocationProviderFactory import org.jetbrains.dokka.base.signatures.KotlinSignatureProvider import org.jetbrains.dokka.base.transformers.pages.comments.CommentsToContentConverter -import org.jetbrains.dokka.base.transformers.pages.samples.DefaultSamplesTransformer import org.jetbrains.dokka.base.translators.documentables.PageContentBuilder import org.jetbrains.dokka.links.DRI import org.jetbrains.dokka.model.Documentable -import org.jetbrains.dokka.model.SourceSetCache -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.model.doc.DocTag import org.jetbrains.dokka.model.properties.PropertyContainer import org.jetbrains.dokka.pages.* @@ -35,7 +31,6 @@ abstract class RenderingOnlyTestBase { DokkaBase().htmlPreprocessors to { _ -> RootCreator }, DokkaBase().externalLocationProviderFactory to { ::JavadocExternalLocationProviderFactory }, DokkaBase().externalLocationProviderFactory to { ::DokkaExternalLocationProviderFactory }, - sourceSetCache = SourceSetCache(), testConfiguration = DokkaConfigurationImpl( "", "", null, false, emptyList(), emptyList(), emptyMap(), emptyList(), false ) @@ -110,7 +105,7 @@ internal object EmptyCommentConverter : CommentsToContentConverter { override fun buildContent( docTag: DocTag, dci: DCI, - sourceSets: Set<SourceSetData>, + sourceSets: Set<DokkaSourceSet>, styles: Set<Style>, extras: PropertyContainer<ContentNode> ): List<ContentNode> = emptyList() diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt index b10202bb..6ceb805b 100644 --- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt @@ -4,15 +4,33 @@ import org.jetbrains.dokka.Platform import org.jetbrains.dokka.SourceRootImpl import org.jetbrains.dokka.base.renderers.html.HtmlRenderer import org.jetbrains.dokka.links.DRI -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.pages.ContentDivergentGroup import org.junit.jupiter.api.Test import renderers.* class DivergentTest : RenderingOnlyTestBase() { - private val js = SourceSetData("root", "js", "JS", Platform.js, listOf(SourceRootImpl("pl1"))) - private val jvm = SourceSetData("root", "jvm", "JVM", Platform.jvm, listOf(SourceRootImpl("pl1"))) - private val native = SourceSetData("root", "native", "NATIVE", Platform.native, listOf(SourceRootImpl("pl1"))) + private val js = defaultSourceSet.copy( + "root", + "JS", + "js", + analysisPlatform = Platform.js, + sourceRoots = listOf(SourceRootImpl("pl1")) + ) + private val jvm = defaultSourceSet.copy( + "root", + "JVM", + "jvm", + + analysisPlatform = Platform.jvm, + sourceRoots = listOf(SourceRootImpl("pl1")) + ) + private val native = defaultSourceSet.copy( + "root", + "NATIVE", + "native", + analysisPlatform = Platform.native, + sourceRoots = listOf(SourceRootImpl("pl1")) + ) @Test fun simpleWrappingCase() { @@ -178,10 +196,10 @@ class DivergentTest : RenderingOnlyTestBase() { HtmlRenderer(context).render(page) renderedContent.match( - Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("a"))),"a+"), - Div(Div(Span(Div(Div("JS")))), Div(Div(Div("bd"))),"bd+"), + Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("a"))), "a+"), + Div(Div(Span(Div(Div("JS")))), Div(Div(Div("bd"))), "bd+"), Div(Div(Span(Div(Div("JVM")))), Div(Div(Div("c")))), - Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("e"))),"e+"), + Div(Div(Span(Div(Div("NATIVE")))), Div(Div(Div("e"))), "e+"), ) } diff --git a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt index 878f442b..c868cfd5 100644 --- a/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/SourceSetDependentHintTest.kt @@ -3,7 +3,6 @@ package renderers.html import org.jetbrains.dokka.Platform import org.jetbrains.dokka.SourceRootImpl import org.jetbrains.dokka.base.renderers.html.HtmlRenderer -import org.jetbrains.dokka.model.SourceSetData import org.jetbrains.dokka.pages.TextStyle import org.junit.jupiter.api.Test import renderers.Div @@ -12,9 +11,28 @@ import renderers.TestPage import renderers.match class SourceSetDependentHintTest : RenderingOnlyTestBase() { - private val pl1 = SourceSetData("root", "pl1", "pl3",Platform.js, listOf(SourceRootImpl("pl1"))) - private val pl2 = SourceSetData("root","pl2", "pl3", Platform.jvm, listOf(SourceRootImpl("pl1"))) - private val pl3 = SourceSetData("root","pl3", "pl3", Platform.native, listOf(SourceRootImpl("pl1"))) + + private val pl1 = defaultSourceSet.copy( + "root", + "pl1", + "pl1", + analysisPlatform = Platform.js, + sourceRoots = listOf(SourceRootImpl("pl1")) + ) + private val pl2 = defaultSourceSet.copy( + "root", + "pl2", + "pl2", + analysisPlatform = Platform.jvm, + sourceRoots = listOf(SourceRootImpl("pl1")) + ) + private val pl3 = defaultSourceSet.copy( + "root", + "pl3", + "pl3", + analysisPlatform = Platform.native, + sourceRoots = listOf(SourceRootImpl("pl1")) + ) @Test fun platformIndependentCase() { diff --git a/plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt b/plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt new file mode 100644 index 00000000..771cabaa --- /dev/null +++ b/plugins/base/src/test/kotlin/renderers/html/defaultSourceSet.kt @@ -0,0 +1,30 @@ +package renderers.html + +import org.jetbrains.dokka.DokkaSourceSetImpl +import org.jetbrains.dokka.Platform + +internal val defaultSourceSet = DokkaSourceSetImpl( + moduleName = "DEFAULT", + displayName = "DEFAULT", + sourceSetID = "DEFAULT", + classpath = emptyList(), + sourceRoots = emptyList(), + dependentSourceSets = emptyList(), + samples = emptyList(), + includes = emptyList(), + includeNonPublic = false, + includeRootPackage = false, + reportUndocumented = false, + skipEmptyPackages = true, + skipDeprecated = false, + jdkVersion = 8, + sourceLinks = emptyList(), + perPackageOptions = emptyList(), + externalDocumentationLinks = emptyList(), + languageVersion = null, + apiVersion = null, + noStdlibLink = false, + noJdkLink = false, + suppressedFiles = emptyList(), + analysisPlatform = Platform.DEFAULT +)
\ No newline at end of file |