diff options
Diffstat (limited to 'plugins/base/src/test')
7 files changed, 185 insertions, 183 deletions
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt index 31f62918..e25567e0 100644 --- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt +++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt @@ -77,6 +77,9 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { + before { + pWrapped("comment to function") + } divergent { bareSignature( emptyMap(), @@ -88,9 +91,6 @@ class ContentForParamsTest : AbstractCoreTest() { "abc" to ParamAttributes(emptyMap(), emptySet(), "String") ) } - after { - pWrapped("comment to function") - } } } } @@ -122,6 +122,10 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { + before { + unnamedTag("Author") { +"Kordyjan" } + unnamedTag("Since") { +"0.11" } + } divergent { bareSignature( emptyMap(), @@ -133,10 +137,6 @@ class ContentForParamsTest : AbstractCoreTest() { "abc" to ParamAttributes(emptyMap(), emptySet(), "String") ) } - after { - unnamedTag("Author") { +"Kordyjan" } - unnamedTag("Since") { +"0.11" } - } } } } @@ -169,6 +169,11 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { + before { + pWrapped("comment to function") + unnamedTag("Author") { +"Kordyjan" } + unnamedTag("Since") { +"0.11" } + } divergent { bareSignature( emptyMap(), @@ -180,11 +185,6 @@ class ContentForParamsTest : AbstractCoreTest() { "abc" to ParamAttributes(emptyMap(), emptySet(), "String") ) } - after { - pWrapped("comment to function") - unnamedTag("Author") { +"Kordyjan" } - unnamedTag("Since") { +"0.11" } - } } } } @@ -216,18 +216,7 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { pWrapped("comment to function") header(2) { +"Parameters" } group { @@ -241,6 +230,17 @@ class ContentForParamsTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -274,15 +274,7 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } - after { + before { pWrapped("comment to function") header(2) { +"Parameters" } group { @@ -304,6 +296,14 @@ class ContentForParamsTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } } } } @@ -336,15 +336,7 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } - after { + before { header(2) { +"Parameters" } group { platformHinted { @@ -365,6 +357,14 @@ class ContentForParamsTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } } } } @@ -397,19 +397,7 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignatureWithReceiver( - emptyMap(), - "", - "", - emptySet(), - "String", - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { pWrapped("comment to function") header(2) { +"Parameters" } group { @@ -427,6 +415,18 @@ class ContentForParamsTest : AbstractCoreTest() { } } } + divergent { + bareSignatureWithReceiver( + emptyMap(), + "", + "", + emptySet(), + "String", + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -459,15 +459,7 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } - after { + before { pWrapped("comment to function") header(2) { +"Parameters" } group { @@ -485,6 +477,14 @@ class ContentForParamsTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } } } } @@ -520,15 +520,7 @@ class ContentForParamsTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), "", "", emptySet(), "function", null, - "first" to ParamAttributes(emptyMap(), emptySet(), "String"), - "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), - "third" to ParamAttributes(emptyMap(), emptySet(), "Double") - ) - } - after { + before { pWrapped("comment to function") unnamedTag("Author") { +"Kordyjan" } unnamedTag("Since") { +"0.11" } @@ -553,6 +545,14 @@ class ContentForParamsTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), "", "", emptySet(), "function", null, + "first" to ParamAttributes(emptyMap(), emptySet(), "String"), + "second" to ParamAttributes(emptyMap(), emptySet(), "Int"), + "third" to ParamAttributes(emptyMap(), emptySet(), "Double") + ) + } } } } diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt index 94288f75..c9adc0bf 100644 --- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt +++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt @@ -36,7 +36,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { val page = module.children.single { it.name == "test" } .children.single { it.name == "function" } as ContentPage page.content.assertNode { - group{ + group { header(1) { +"function" } } divergentGroup { @@ -82,18 +82,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { header(2) { +"See also" } group { platformHinted { @@ -107,6 +96,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -137,18 +137,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { header(2) { +"See also" } group { platformHinted { @@ -162,6 +151,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -192,18 +192,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { header(2) { +"See also" } group { platformHinted { @@ -217,6 +206,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -247,18 +247,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { header(2) { +"See also" } group { platformHinted { @@ -272,6 +261,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -305,18 +305,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { pWrapped("random comment") unnamedTag("Author") { +"pikinier20" } unnamedTag("Since") { +"0.11" } @@ -334,6 +323,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -365,18 +365,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { header(2) { +"See also" } group { platformHinted { @@ -390,6 +379,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } @@ -421,18 +421,7 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } divergentGroup { divergentInstance { - divergent { - bareSignature( - emptyMap(), - "", - "", - emptySet(), - "function", - null, - "abc" to ParamAttributes(emptyMap(), emptySet(), "String") - ) - } - after { + before { header(2) { +"See also" } group { platformHinted { @@ -451,6 +440,17 @@ class ContentForSeeAlsoTest : AbstractCoreTest() { } } } + divergent { + bareSignature( + emptyMap(), + "", + "", + emptySet(), + "function", + null, + "abc" to ParamAttributes(emptyMap(), emptySet(), "String") + ) + } } } } diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt index 74fc18c4..a8b78baa 100644 --- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt +++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt @@ -192,6 +192,9 @@ class EnumsTest : AbstractCoreTest() { |package enums | |enum class Test { + | /** + | Sample docs for E1 + | **/ | @SinceKotlin("1.3") | E1 |} @@ -206,6 +209,11 @@ class EnumsTest : AbstractCoreTest() { header(1) { +"E1" } platformHinted { group { + group { + + "Sample docs for E1" + } + } + group { mapOf("SinceKotlin" to setOf("version")).entries.forEach { group { group { diff --git a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt index 33d3f64c..7cdb0de3 100644 --- a/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt +++ b/plugins/base/src/test/kotlin/linkableContent/LinkableContentTest.kt @@ -164,13 +164,11 @@ class LinkableContentTest : AbstractCoreTest() { val function = classChildren.find { it.name == "printWithExclamation" } val text = function.cast<MemberPageNode>().content.cast<ContentGroup>().children.last() .cast<ContentDivergentGroup>().children.single() - .cast<ContentDivergentInstance>().after + .cast<ContentDivergentInstance>().before .cast<ContentGroup>().children.last() .cast<ContentGroup>().children.last() .cast<PlatformHintedContent>().children.single() .cast<ContentGroup>().children.single() - .cast<ContentTable>().children.single() - .cast<ContentGroup>().children.single() .cast<ContentGroup>().children.single() .cast<ContentCode>().children.single().cast<ContentText>().text Assertions.assertEquals( diff --git a/plugins/base/src/test/kotlin/markdown/LinkTest.kt b/plugins/base/src/test/kotlin/markdown/LinkTest.kt index fe5b573a..20bd24ee 100644 --- a/plugins/base/src/test/kotlin/markdown/LinkTest.kt +++ b/plugins/base/src/test/kotlin/markdown/LinkTest.kt @@ -33,15 +33,12 @@ class LinkTest : AbstractCoreTest() { configuration ) { renderingStage = { rootPageNode, _ -> - (rootPageNode.children.single().children.single() as MemberPageNode) + assertNotNull((rootPageNode.children.single().children.single() as MemberPageNode) .content - .dfs { node -> node is ContentDRILink } - .let { - assertEquals( - "parser//test/#java.lang.ClassLoader/PointingToDeclaration/", - (it as ContentDRILink).address.toString() - ) - } + .dfs { node -> + node is ContentDRILink && + node.address.toString() == "parser//test/#java.lang.ClassLoader/PointingToDeclaration/"} + ) } } } diff --git a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt index f58b0e24..a3bf9188 100644 --- a/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt +++ b/plugins/base/src/test/kotlin/renderers/RenderingOnlyTestBase.kt @@ -90,6 +90,7 @@ fun Element.match(vararg matchers: Any): Unit = open class Tag(val name: String, vararg val matchers: Any) class Div(vararg matchers: Any): Tag("div", *matchers) class P(vararg matchers: Any): Tag("p", *matchers) +class Span(vararg matchers: Any): Tag("span", *matchers) private fun Any.accepts(n: Node) { when (this) { diff --git a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt index 54bac755..fa129760 100644 --- a/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt +++ b/plugins/base/src/test/kotlin/renderers/html/DivergentTest.kt @@ -6,12 +6,8 @@ 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.jetbrains.dokka.pages.TextStyle import org.junit.jupiter.api.Test -import renderers.Div -import renderers.RenderingOnlyTestBase -import renderers.TestPage -import renderers.match +import renderers.* class DivergentTest : RenderingOnlyTestBase() { private val js = SourceSetData("root", "JS", Platform.js, listOf(SourceRootImpl("pl1"))) @@ -182,10 +178,10 @@ class DivergentTest : RenderingOnlyTestBase() { HtmlRenderer(context).render(page) renderedContent.match( - Div(Div(Div(Div("a")), Div(Div())), "a+",), - Div(Div(Div(Div("bd")), Div(Div())), "bd+"), - Div(Div(Div(Div("c")), Div(Div()))), - Div(Div(Div(Div("e")), Div(Div())), "e+") + 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+"), ) } @@ -215,7 +211,10 @@ class DivergentTest : RenderingOnlyTestBase() { HtmlRenderer(context).render(page) renderedContent.match( Div( - "ab-", + Div( + "ab-", + Span() + ), Div(Div(Div("ab"))) ) ) @@ -283,10 +282,9 @@ class DivergentTest : RenderingOnlyTestBase() { } HtmlRenderer(context).render(page) - val r = renderedContent renderedContent.match( Div( - "ab-", + Div("ab-", Span()), Div(Div(Div("ab"))), "ab+" ) @@ -324,8 +322,8 @@ class DivergentTest : RenderingOnlyTestBase() { HtmlRenderer(context).render(page) renderedContent.match( - Div("a-", Div(Div(Div("a")), Div(Div("NATIVE"))), "ab+"), - Div("b-", Div(Div(Div("b")), Div(Div("NATIVE"))), "ab+") + Div(Div("a-", Span()), Div(Div(Div("a"))), "ab+"), + Div(Div("b-", Span()), Div(Div(Div(("b")))), "ab+") ) } }
\ No newline at end of file |