diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 20:16:27 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-11 20:16:27 +0400 |
commit | f2f6fd9fa48aaa49e16eaa78b86be89e1a232ad7 (patch) | |
tree | 0f05fcea870074df16c7d2481ac52476d40c5fd5 /test/src | |
parent | cc008898485627a805c8275dede9883529712cb9 (diff) | |
download | dokka-f2f6fd9fa48aaa49e16eaa78b86be89e1a232ad7.tar.gz dokka-f2f6fd9fa48aaa49e16eaa78b86be89e1a232ad7.tar.bz2 dokka-f2f6fd9fa48aaa49e16eaa78b86be89e1a232ad7.zip |
Add top level property tests.
Diffstat (limited to 'test/src')
-rw-r--r-- | test/src/FunctionTest.kt | 13 | ||||
-rw-r--r-- | test/src/PropertyTest.kt | 91 |
2 files changed, 100 insertions, 4 deletions
diff --git a/test/src/FunctionTest.kt b/test/src/FunctionTest.kt index 2c0955d1..11cfbb6b 100644 --- a/test/src/FunctionTest.kt +++ b/test/src/FunctionTest.kt @@ -9,8 +9,8 @@ public class FunctionTest { Test fun function() { verifyModel("test/data/functions/function.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals(DocumentationNodeKind.Function, kind) assertEquals("fn", name) + assertEquals(DocumentationNodeKind.Function, kind) assertEquals("Function fn", doc) assertTrue(details.none()) assertTrue(members.none()) @@ -22,14 +22,19 @@ public class FunctionTest { Test fun functionWithParams() { verifyModel("test/data/functions/functionWithParams.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals(DocumentationNodeKind.Function, kind) assertEquals("function", name) + assertEquals(DocumentationNodeKind.Function, kind) assertEquals("""Multiline Function Documentation""" , doc) - assertEquals("x", details.single().name) - assertEquals(DocumentationNodeKind.Parameter, details.single().kind) + with(details.single()) { + assertEquals("x", name) + assertEquals(DocumentationNodeKind.Parameter, kind) + assertTrue(details.none()) + assertTrue(members.none()) + assertTrue(links.none()) + } assertTrue(members.none()) assertTrue(links.none()) diff --git a/test/src/PropertyTest.kt b/test/src/PropertyTest.kt new file mode 100644 index 00000000..6d66af97 --- /dev/null +++ b/test/src/PropertyTest.kt @@ -0,0 +1,91 @@ +package com.jetbrains.dokka.tests + +import org.junit.Test +import kotlin.test.* +import com.jetbrains.dokka.* + + +public class PropertyTest { + Test fun valueProperty() { + verifyModel("test/data/properties/valueProperty.kt") { model -> + with(model.nodes.single().members.single()) { + assertEquals("property", name) + assertEquals(DocumentationNodeKind.Property, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(members.none()) + assertTrue(links.none()) + } + } + } + + Test fun variableProperty() { + verifyModel("test/data/properties/variableProperty.kt") { model -> + with(model.nodes.single().members.single()) { + assertEquals("property", name) + assertEquals(DocumentationNodeKind.Property, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(members.none()) + assertTrue(links.none()) + } + } + } + + Test fun valuePropertyWithGetter() { + verifyModel("test/data/properties/valuePropertyWithGetter.kt") { model -> + with(model.nodes.single().members.single()) { + assertEquals("property", name) + assertEquals(DocumentationNodeKind.Property, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(links.none()) + with(members.single()) { + assertEquals("<get-property>", name) + assertEquals(DocumentationNodeKind.Function, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(links.none()) + assertTrue(members.none()) + } + } + } + } + + Test fun variablePropertyWithAccessors() { + verifyModel("test/data/properties/variablePropertyWithAccessors.kt") { model -> + with(model.nodes.single().members.single()) { + assertEquals("property", name) + assertEquals(DocumentationNodeKind.Property, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(links.none()) + + assertEquals(2, members.count()) + with(members.elementAt(0)) { + assertEquals("<get-property>", name) + assertEquals(DocumentationNodeKind.Function, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(links.none()) + assertTrue(members.none()) + } + with(members.elementAt(1)) { + assertEquals("<set-property>", name) + assertEquals(DocumentationNodeKind.Function, kind) + assertEquals("", doc) + with(details.single()) { + assertEquals("value", name) + assertEquals(DocumentationNodeKind.Parameter, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(links.none()) + assertTrue(members.none()) + } + assertTrue(links.none()) + assertTrue(members.none()) + } + } + } + } +} |