aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/content
diff options
context:
space:
mode:
authorKamil Doległo <kamilok1965@interia.pl>2020-05-18 17:14:23 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-05-19 09:56:32 +0200
commit5451627eb0cf8d95dafd23e96665e062ef023d75 (patch)
tree3406e8930239681c41dadf47f75efd8bf2fde0a2 /plugins/base/src/test/kotlin/content
parentf15ecdd5fadae9169c8b35e0bf8a1786d57563a7 (diff)
downloaddokka-5451627eb0cf8d95dafd23e96665e062ef023d75.tar.gz
dokka-5451627eb0cf8d95dafd23e96665e062ef023d75.tar.bz2
dokka-5451627eb0cf8d95dafd23e96665e062ef023d75.zip
Add test utils for ContentDivergent and fix the tests
Diffstat (limited to 'plugins/base/src/test/kotlin/content')
-rw-r--r--plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt341
-rw-r--r--plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt238
2 files changed, 353 insertions, 226 deletions
diff --git a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
index 4a6b5264..fbed41fc 100644
--- a/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
+++ b/plugins/base/src/test/kotlin/content/params/ContentForParamsTest.kt
@@ -4,10 +4,7 @@ import matchers.content.*
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Test
-import utils.pWrapped
-import utils.signature
-import utils.signatureWithReceiver
-import utils.unnamedTag
+import utils.*
class ContentForParamsTest : AbstractCoreTest() {
private val testConfiguration = dokkaConfiguration {
@@ -36,9 +33,13 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ }
}
}
}
@@ -63,13 +64,19 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ }
+ }
+ }
}
}
}
@@ -95,14 +102,20 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- unnamedTag("Author") { +"Kordyjan" }
- unnamedTag("Since") { +"0.11" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ unnamedTag("Author") { +"Kordyjan" }
+ unnamedTag("Since") { +"0.11" }
+ }
+ }
+ }
}
}
}
@@ -129,15 +142,21 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
- unnamedTag("Author") { +"Kordyjan" }
- unnamedTag("Since") { +"0.11" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ unnamedTag("Author") { +"Kordyjan" }
+ unnamedTag("Since") { +"0.11" }
+ }
+ }
+ }
}
}
}
@@ -163,18 +182,24 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
- header(4) { +"Parameters" }
- table {
- group {
- +"abc"
- group { +"comment to param" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ header(4) { +"Parameters" }
+ table {
+ group {
+ +"abc"
+ group { +"comment to param" }
+ }
+ }
+ }
}
}
}
@@ -204,26 +229,38 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "first" to "String", "second" to "Int", "third" to "Double")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
- header(4) { +"Parameters" }
- table {
- group {
- +"first"
- group { +"comment to first param" }
- }
- group {
- +"second"
- group { +"comment to second param" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature(
+ "function",
+ null,
+ "first" to "String",
+ "second" to "Int",
+ "third" to "Double"
+ )
}
- group {
- +"third"
- group { +"comment to third param" }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ header(4) { +"Parameters" }
+ table {
+ group {
+ +"first"
+ group { +"comment to first param" }
+ }
+ group {
+ +"second"
+ group { +"comment to second param" }
+ }
+ group {
+ +"third"
+ group { +"comment to third param" }
+ }
+ }
+ }
}
}
}
@@ -252,25 +289,37 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "first" to "String", "second" to "Int", "third" to "Double")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"Parameters" }
- table {
- group {
- +"first"
- group { +"comment to first param" }
- }
- group {
- +"second"
- group { +"comment to second param" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature(
+ "function",
+ null,
+ "first" to "String",
+ "second" to "Int",
+ "third" to "Double"
+ )
}
- group {
- +"third"
- group { +"comment to third param" }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"Parameters" }
+ table {
+ group {
+ +"first"
+ group { +"comment to first param" }
+ }
+ group {
+ +"second"
+ group { +"comment to second param" }
+ }
+ group {
+ +"third"
+ group { +"comment to third param" }
+ }
+ }
+ }
}
}
}
@@ -299,22 +348,28 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signatureWithReceiver("String", "function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
- header(4) { +"Parameters" }
- table {
- group {
- +"<receiver>"
- group { +"comment to receiver" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignatureWithReceiver("String", "function", null, "abc" to "String")
}
- group {
- +"abc"
- group { +"comment to param" }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ header(4) { +"Parameters" }
+ table {
+ group {
+ +"<receiver>"
+ group { +"comment to receiver" }
+ }
+ group {
+ +"abc"
+ group { +"comment to param" }
+ }
+ }
+ }
}
}
}
@@ -343,22 +398,34 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "first" to "String", "second" to "Int", "third" to "Double")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
- header(4) { +"Parameters" }
- table {
- group {
- +"first"
- group { +"comment to first param" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature(
+ "function",
+ null,
+ "first" to "String",
+ "second" to "Int",
+ "third" to "Double"
+ )
}
- group {
- +"third"
- group { +"comment to third param" }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ header(4) { +"Parameters" }
+ table {
+ group {
+ +"first"
+ group { +"comment to first param" }
+ }
+ group {
+ +"third"
+ group { +"comment to third param" }
+ }
+ }
+ }
}
}
}
@@ -390,30 +457,42 @@ class ContentForParamsTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "first" to "String", "second" to "Int", "third" to "Double")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("comment to function")
- header(4) { +"Parameters" }
- table {
- group {
- +"first"
- group { +"comment to first param" }
- }
- group {
- +"second"
- group { +"comment to second param" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature(
+ "function",
+ null,
+ "first" to "String",
+ "second" to "Int",
+ "third" to "Double"
+ )
}
- group {
- +"third"
- group { +"comment to third param" }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("comment to function")
+ header(4) { +"Parameters" }
+ table {
+ group {
+ +"first"
+ group { +"comment to first param" }
+ }
+ group {
+ +"second"
+ group { +"comment to second param" }
+ }
+ group {
+ +"third"
+ group { +"comment to third param" }
+ }
+ }
+ unnamedTag("Author") { +"Kordyjan" }
+ unnamedTag("Since") { +"0.11" }
+ }
}
}
- unnamedTag("Author") { +"Kordyjan" }
- unnamedTag("Since") { +"0.11" }
}
}
}
diff --git a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
index ae53a848..8121543d 100644
--- a/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
+++ b/plugins/base/src/test/kotlin/content/seealso/ContentForSeeAlsoTest.kt
@@ -1,10 +1,11 @@
package content.seealso
+
import matchers.content.*
import org.jetbrains.dokka.pages.ContentPage
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.junit.jupiter.api.Test
+import utils.bareSignature
import utils.pWrapped
-import utils.signature
import utils.unnamedTag
class ContentForSeeAlsoTest : AbstractCoreTest() {
@@ -34,9 +35,13 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ }
}
}
}
@@ -61,18 +66,24 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"abc" }
- group { }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"abc" }
+ group { }
+ }
+ }
+ }
}
}
}
@@ -99,18 +110,24 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"abc" }
- group { +"Comment to abc" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"abc" }
+ group { +"Comment to abc" }
+ }
+ }
+ }
}
}
}
@@ -137,18 +154,24 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "kotlin.collections/Collection////"
- link{ +"Collection"}
- group { }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "kotlin.collections/Collection////"
+ link { +"Collection" }
+ group { }
+ }
+ }
+ }
}
}
}
@@ -175,18 +198,25 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"Collection" }
- group { +"Comment to stdliblink" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"Collection" }
+ group { +"Comment to stdliblink" }
+ }
+ }
+ }
+
}
}
}
@@ -216,21 +246,27 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- pWrapped("random comment")
- unnamedTag("Author") { +"pikinier20" }
- unnamedTag("Since") { +"0.11" }
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"Collection" }
- group { +"Comment to stdliblink" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ pWrapped("random comment")
+ unnamedTag("Author") { +"pikinier20" }
+ unnamedTag("Since") { +"0.11" }
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"Collection" }
+ group { +"Comment to stdliblink" }
+ }
+ }
+ }
}
}
}
@@ -258,18 +294,24 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"abc" }
- group { +"Comment to abc2" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
+ }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"abc" }
+ group { +"Comment to abc2" }
+ }
+ }
+ }
}
}
}
@@ -297,23 +339,29 @@ class ContentForSeeAlsoTest : AbstractCoreTest() {
val page = module.children.single { it.name == "test" }
.children.single { it.name == "function" } as ContentPage
page.content.assertNode {
- group {
- header(1) { +"function" }
- signature("function", null, "abc" to "String")
- }
- header(3) { +"Description" }
- platformHinted {
- header(4) { +"See also" }
- table {
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"abc" }
- group { +"Comment to abc1" }
+ header(1) { +"function" }
+ divergentGroup {
+ divergentInstance {
+ divergent {
+ bareSignature("function", null, "abc" to "String")
}
- group {
- //DRI should be "test//abc/#/-1/"
- link{ +"Collection" }
- group { +"Comment to collection" }
+ after {
+ header(3) { +"Description" }
+ platformHinted {
+ header(4) { +"See also" }
+ table {
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"abc" }
+ group { +"Comment to abc1" }
+ }
+ group {
+ //DRI should be "test//abc/#/-1/"
+ link { +"Collection" }
+ group { +"Comment to collection" }
+ }
+ }
+ }
}
}
}