From f2f6fd9fa48aaa49e16eaa78b86be89e1a232ad7 Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Fri, 11 Jul 2014 20:16:27 +0400 Subject: Add top level property tests. --- test/src/FunctionTest.kt | 13 ++++--- test/src/PropertyTest.kt | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+), 4 deletions(-) create mode 100644 test/src/PropertyTest.kt (limited to 'test/src') 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("", 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("", name) + assertEquals(DocumentationNodeKind.Function, kind) + assertEquals("", doc) + assertTrue(details.none()) + assertTrue(links.none()) + assertTrue(members.none()) + } + with(members.elementAt(1)) { + assertEquals("", 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()) + } + } + } + } +} -- cgit