From d627d2cfdfebcddd63669734efb82dfc66e7c7fe Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Sat, 12 Jul 2014 03:25:39 +0400 Subject: Convert string doc to structured DocumentationContent --- test/src/model/ClassTest.kt | 24 ++++++++++++------------ test/src/model/CommentTest.kt | 17 +++++++++-------- test/src/model/FunctionTest.kt | 22 +++++++++++----------- test/src/model/PackageTest.kt | 6 +++--- test/src/model/PropertyTest.kt | 16 ++++++++-------- 5 files changed, 43 insertions(+), 42 deletions(-) (limited to 'test') diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt index 8032b928..d5953811 100644 --- a/test/src/model/ClassTest.kt +++ b/test/src/model/ClassTest.kt @@ -10,7 +10,7 @@ public class ClassTest { with(model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertEquals("", members.single().name) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class ClassTest { with(model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertEquals("", members.single().name) assertTrue(links.none()) @@ -36,7 +36,7 @@ public class ClassTest { with(model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Object, kind) assertEquals("Obj", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -49,20 +49,20 @@ public class ClassTest { with (model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(links.none()) assertEquals(1, members.count()) with(members.elementAt(0)) { assertEquals("", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNodeKind.Constructor, kind) assertEquals(1, details.count()) with(details.elementAt(0)) { assertEquals("name", name) assertEquals(DocumentationNodeKind.Parameter, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) @@ -79,14 +79,14 @@ public class ClassTest { with(model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(links.none()) assertEquals(2, members.count()) with(members.elementAt(0)) { assertEquals("", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNodeKind.Constructor, kind) assertTrue(details.none()) assertTrue(links.none()) @@ -94,7 +94,7 @@ public class ClassTest { } with(members.elementAt(1)) { assertEquals("fn", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("Unit", details.single().name) assertTrue(links.none()) @@ -109,14 +109,14 @@ public class ClassTest { with(model.nodes.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(links.none()) assertEquals(2, members.count()) with(members.elementAt(0)) { assertEquals("", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNodeKind.Constructor, kind) assertTrue(details.none()) assertTrue(members.none()) @@ -124,7 +124,7 @@ public class ClassTest { } with(members.elementAt(1)) { assertEquals("name", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals(DocumentationNodeKind.Property, kind) assertEquals("String", details.single().name) assertTrue(members.none()) diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt index 7da50c1a..f7d313fe 100644 --- a/test/src/model/CommentTest.kt +++ b/test/src/model/CommentTest.kt @@ -2,12 +2,13 @@ package org.jetbrains.dokka.tests import org.junit.Test import kotlin.test.* +import org.jetbrains.dokka.* public class CommentTest { Test fun emptyDoc() { verifyModel("test/data/comments/emptyDoc.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) } } } @@ -15,7 +16,7 @@ public class CommentTest { Test fun emptyDocButComment() { verifyModel("test/data/comments/emptyDocButComment.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) } } } @@ -25,7 +26,7 @@ public class CommentTest { with(model.nodes.single().members.single()) { assertEquals("""doc1 doc2 -doc3""", doc) +doc3""", doc.summary) } } } @@ -35,7 +36,7 @@ doc3""", doc) with(model.nodes.single().members.single()) { assertEquals("""doc1 doc2 -doc3""", doc) +doc3""", doc.summary) } } } @@ -45,7 +46,7 @@ doc3""", doc) with(model.nodes.single().members.single()) { assertEquals("""doc1 doc2 -doc3""", doc) +doc3""", doc.summary) } } } @@ -53,7 +54,7 @@ doc3""", doc) Test fun oneLineDoc() { verifyModel("test/data/comments/oneLineDoc.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals("doc", doc) + assertEquals("doc", doc.summary) } } } @@ -61,7 +62,7 @@ doc3""", doc) Test fun oneLineDocWithComment() { verifyModel("test/data/comments/oneLineDocWithComment.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals("doc", doc) + assertEquals("doc", doc.summary) } } } @@ -69,7 +70,7 @@ doc3""", doc) Test fun oneLineDocWithEmptyLine() { verifyModel("test/data/comments/oneLineDocWithEmptyLine.kt") { model -> with(model.nodes.single().members.single()) { - assertEquals("doc", doc) + assertEquals("doc", doc.summary) } } } diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index 641b70a7..5499b21b 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -10,7 +10,7 @@ public class FunctionTest { with(model.nodes.single().members.single()) { assertEquals("fn", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("Function fn", doc) + assertEquals("Function fn", doc.summary) assertEquals("Unit", details.single().name) assertTrue(members.none()) assertTrue(links.none()) @@ -23,14 +23,14 @@ public class FunctionTest { with(model.nodes.single().members.single()) { assertEquals("fn", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("Function with receiver", doc) + assertEquals("Function with receiver", doc.summary) assertEquals("Unit", details.elementAt(0).name) assertEquals(2, details.count()) with(details.elementAt(1)) { assertEquals("", name) assertEquals(DocumentationNodeKind.Receiver, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) @@ -46,14 +46,14 @@ public class FunctionTest { with(model.nodes.single().members.single()) { assertEquals("generic", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("generic function", doc) + assertEquals("generic function", doc.summary) assertEquals(2, details.count()) assertEquals("Unit", details.elementAt(0).name) with(details.elementAt(1)) { assertEquals("T", name) assertEquals(DocumentationNodeKind.TypeParameter, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -69,18 +69,18 @@ public class FunctionTest { with(model.nodes.single().members.single()) { assertEquals("generic", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("generic function", doc) + assertEquals("generic function", doc.summary) assertEquals(3, details.count()) assertEquals("Unit", details.elementAt(0).name) with(details.elementAt(1)) { assertEquals("T", name) assertEquals(DocumentationNodeKind.TypeParameter, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) with(details.single()) { assertEquals("R", name) assertEquals(DocumentationNodeKind.UpperBound, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -91,7 +91,7 @@ public class FunctionTest { with(details.elementAt(2)) { assertEquals("R", name) assertEquals(DocumentationNodeKind.TypeParameter, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(members.none()) assertTrue(links.none()) } @@ -110,14 +110,14 @@ public class FunctionTest { assertEquals("""Multiline Function Documentation""" - , doc) + , doc.summary) assertEquals(2, details.count()) assertEquals("Unit", details.elementAt(0).name) with(details.elementAt(1)) { assertEquals("x", name) assertEquals(DocumentationNodeKind.Parameter, kind) - assertEquals("parameter", doc) + assertEquals("parameter", doc.summary) assertEquals("Int", details.single().name) assertTrue(members.none()) assertTrue(links.none()) diff --git a/test/src/model/PackageTest.kt b/test/src/model/PackageTest.kt index 7b376012..d95b799a 100644 --- a/test/src/model/PackageTest.kt +++ b/test/src/model/PackageTest.kt @@ -10,7 +10,7 @@ public class PackageTest { with(model.nodes.single()) { assertEquals(DocumentationNodeKind.Package, kind) assertEquals("", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class PackageTest { with(model.nodes.single()) { assertEquals(DocumentationNodeKind.Package, kind) assertEquals("simple", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -36,7 +36,7 @@ public class PackageTest { with(model.nodes.single()) { assertEquals(DocumentationNodeKind.Package, kind) assertEquals("dot.name", name) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index ed82bfec..f005d20d 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -10,7 +10,7 @@ public class PropertyTest { with(model.nodes.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class PropertyTest { with(model.nodes.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) @@ -36,13 +36,13 @@ public class PropertyTest { with(model.nodes.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(links.none()) with(members.single()) { assertEquals("", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) @@ -56,7 +56,7 @@ public class PropertyTest { with(model.nodes.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(links.none()) @@ -64,7 +64,7 @@ public class PropertyTest { with(members.elementAt(0)) { assertEquals("", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) @@ -72,13 +72,13 @@ public class PropertyTest { with(members.elementAt(1)) { assertEquals("", name) assertEquals(DocumentationNodeKind.Function, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals(2, details.count()) assertEquals("Unit", details.elementAt(0).name) with(details.elementAt(1)) { assertEquals("value", name) assertEquals(DocumentationNodeKind.Parameter, kind) - assertEquals("", doc) + assertEquals(DocumentationContent.Empty, doc) assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) -- cgit