diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-12-16 21:41:32 +0300 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-12-16 21:41:32 +0300 |
commit | bd6cddd932c308519ce386197b93de145462bec2 (patch) | |
tree | 5cb04a2cd8f7dfd7e1c679f16977a51d5d966faa /test/src/model | |
parent | 9535260e7b9f1483fbbfcf0abf4c171311fd92b7 (diff) | |
download | dokka-bd6cddd932c308519ce386197b93de145462bec2.tar.gz dokka-bd6cddd932c308519ce386197b93de145462bec2.tar.bz2 dokka-bd6cddd932c308519ce386197b93de145462bec2.zip |
Process short links.
Diffstat (limited to 'test/src/model')
-rw-r--r-- | test/src/model/CommentTest.kt | 2 | ||||
-rw-r--r-- | test/src/model/FunctionTest.kt | 30 | ||||
-rw-r--r-- | test/src/model/LinkTest.kt | 48 | ||||
-rw-r--r-- | test/src/model/PropertyTest.kt | 4 |
4 files changed, 66 insertions, 18 deletions
diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt index b2ad0ac0..5fc95726 100644 --- a/test/src/model/CommentTest.kt +++ b/test/src/model/CommentTest.kt @@ -25,7 +25,7 @@ public class CommentTest { verifyModel("test/data/comments/multilineDoc.kt") { model -> with(model.members.single().members.single()) { assertEquals("doc1", content.summary.toTestString()) - assertEquals("doc2\ndoc3\n", content.description.toTestString()) + assertEquals("doc2\ndoc3", content.description.toTestString()) } } } diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index c6ad93cc..2a4ad0a5 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -24,12 +24,10 @@ public class FunctionTest { assertEquals("fn", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals("Function with receiver", content.summary.toTestString()) - assertEquals("Unit", details.elementAt(0).name) - assertEquals(4, details.count()) + assertEquals("internal", details.elementAt(0).name) assertEquals("final", details.elementAt(1).name) - assertEquals("internal", details.elementAt(2).name) - with(details.elementAt(3)) { + with(details.elementAt(2)) { assertEquals("<this>", name) assertEquals(DocumentationNode.Kind.Receiver, kind) assertEquals(Content.Empty, content) @@ -37,6 +35,7 @@ public class FunctionTest { assertTrue(members.none()) assertTrue(links.none()) } + assertEquals("Unit", details.elementAt(3).name) assertTrue(members.none()) assertTrue(links.none()) } @@ -51,10 +50,9 @@ public class FunctionTest { assertEquals("generic function", content.summary.toTestString()) assertEquals(4, details.count()) - assertEquals("Unit", details.elementAt(0).name) + assertEquals("private", details.elementAt(0).name) assertEquals("final", details.elementAt(1).name) - assertEquals("private", details.elementAt(2).name) - with(details.elementAt(3)) { + with(details.elementAt(2)) { assertEquals("T", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) assertEquals(Content.Empty, content) @@ -62,6 +60,7 @@ public class FunctionTest { assertTrue(members.none()) assertTrue(links.none()) } + assertEquals("Unit", details.elementAt(3).name) assertTrue(members.none()) assertTrue(links.none()) @@ -76,15 +75,16 @@ public class FunctionTest { assertEquals("generic function", content.summary.toTestString()) assertEquals(5, details.count()) - assertEquals("Unit", details.elementAt(0).name) + assertEquals("public", details.elementAt(0).name) assertEquals("final", details.elementAt(1).name) - assertEquals("public", details.elementAt(2).name) - with(details.elementAt(3)) { + with(details.elementAt(2)) { assertEquals("T", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) assertEquals(Content.Empty, content) with(details.single()) { assertEquals("R", name) + assertEquals("R", name) + assertEquals("R", name) assertEquals(DocumentationNode.Kind.UpperBound, kind) assertEquals(Content.Empty, content) assertTrue(details.none()) @@ -94,13 +94,14 @@ public class FunctionTest { assertTrue(members.none()) assertTrue(links.none()) } - with(details.elementAt(4)) { + with(details.elementAt(3)) { assertEquals("R", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) assertEquals(Content.Empty, content) assertTrue(members.none()) assertTrue(links.none()) } + assertEquals("Unit", details.elementAt(4).name) assertTrue(members.none()) assertTrue(links.none()) @@ -118,10 +119,9 @@ public class FunctionTest { Documentation""", content.description.toTestString()) assertEquals(4, details.count()) - assertEquals("Unit", details.elementAt(0).name) + assertEquals("internal", details.elementAt(0).name) assertEquals("final", details.elementAt(1).name) - assertEquals("internal", details.elementAt(2).name) - with(details.elementAt(3)) { + with(details.elementAt(2)) { assertEquals("x", name) assertEquals(DocumentationNode.Kind.Parameter, kind) assertEquals("parameter", content.summary.toTestString()) @@ -129,7 +129,7 @@ Documentation""", content.description.toTestString()) assertTrue(members.none()) assertTrue(links.none()) } - + assertEquals("Unit", details.elementAt(3).name) assertTrue(members.none()) assertTrue(links.none()) } diff --git a/test/src/model/LinkTest.kt b/test/src/model/LinkTest.kt new file mode 100644 index 00000000..151d2696 --- /dev/null +++ b/test/src/model/LinkTest.kt @@ -0,0 +1,48 @@ +package org.jetbrains.dokka.tests + +import org.junit.Test +import kotlin.test.* +import org.jetbrains.dokka.* + +public class LinkTest { + Test fun linkToSelf() { + verifyModel("test/data/links/linkToSelf.kt") { model -> + with(model.members.single().members.single()) { + assertEquals("Foo", name) + assertEquals(DocumentationNode.Kind.Class, kind) + assertEquals("This is link to [Foo -> Class:Foo]", content.summary.toTestString()) + } + } + } + + Test fun linkToMember() { + verifyModel("test/data/links/linkToMember.kt") { model -> + with(model.members.single().members.single()) { + assertEquals("Foo", name) + assertEquals(DocumentationNode.Kind.Class, kind) + assertEquals("This is link to [member -> Function:member]", content.summary.toTestString()) + } + } + } + + Test fun linkToQualifiedMember() { + verifyModel("test/data/links/linkToQualifiedMember.kt") { model -> + with(model.members.single().members.single()) { + assertEquals("Foo", name) + assertEquals(DocumentationNode.Kind.Class, kind) + assertEquals("This is link to [Foo.member -> Function:member]", content.summary.toTestString()) + } + } + } + + Test fun linkToParam() { + verifyModel("test/data/links/linkToParam.kt") { model -> + with(model.members.single().members.single()) { + assertEquals("Foo", name) + assertEquals(DocumentationNode.Kind.Function, kind) + assertEquals("This is link to [param -> Parameter:param]", content.summary.toTestString()) + } + } + } + +}
\ No newline at end of file diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index 93d81769..7cd287a0 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -40,7 +40,7 @@ public class PropertyTest { assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) with(members.single()) { - assertEquals("<get-property>", name) + assertEquals("<get>", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals(Content.Empty, content) assertEquals("String", detail(DocumentationNode.Kind.Type).name) @@ -66,7 +66,7 @@ public class PropertyTest { assertEquals(2, members.count()) with(members.elementAt(0)) { - assertEquals("<get-property>", name) + assertEquals("<get>", name) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals(Content.Empty, content) val get_modifiers = details(DocumentationNode.Kind.Modifier).map { it.name } |