From 280dc29f14d0aa66f4c799d15d478a6d9920841e Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Tue, 14 Oct 2014 16:08:10 +0400 Subject: Use module.md to get package descriptors, filter sections with names of members, fix markdown for kotlin website, propagate content from parent to child with the name of section. --- test/src/model/ClassTest.kt | 24 +++++++------- test/src/model/CommentTest.kt | 72 +++++++++++++++++++++--------------------- test/src/model/FunctionTest.kt | 24 +++++++------- test/src/model/JavaTest.kt | 2 +- test/src/model/PackageTest.kt | 12 +++---- test/src/model/PropertyTest.kt | 16 +++++----- 6 files changed, 75 insertions(+), 75 deletions(-) (limited to 'test/src') diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt index 7068038f..65363c92 100644 --- a/test/src/model/ClassTest.kt +++ b/test/src/model/ClassTest.kt @@ -10,7 +10,7 @@ public class ClassTest { with(model.members.single().members.single()) { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(2, details.count()) assertEquals("", members.single().name) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class ClassTest { with(model.members.single().members.single()) { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(2, details.count()) assertEquals("", members.single().name) assertTrue(links.none()) @@ -36,7 +36,7 @@ public class ClassTest { with(model.members.single().members.single()) { assertEquals(DocumentationNode.Kind.Object, kind) assertEquals("Obj", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(2, details.count()) assertTrue(members.none()) assertTrue(links.none()) @@ -49,21 +49,21 @@ public class ClassTest { with (model.members.single().members.single()) { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(2, details.count()) assertTrue(links.none()) assertEquals(1, members.count()) with(members.elementAt(0)) { assertEquals("", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(DocumentationNode.Kind.Constructor, kind) assertEquals(2, details.count()) assertEquals("public", details.elementAt(0).name) with(details.elementAt(1)) { assertEquals("name", name) assertEquals(DocumentationNode.Kind.Parameter, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", details.single().name) assertTrue(links.none()) assertTrue(members.none()) @@ -80,14 +80,14 @@ public class ClassTest { with(model.members.single().members.single()) { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(2, details.count()) assertTrue(links.none()) assertEquals(2, members.count()) with(members.elementAt(0)) { assertEquals("", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(DocumentationNode.Kind.Constructor, kind) assertEquals(1, details.count()) assertEquals("public", details.elementAt(0).name) @@ -96,7 +96,7 @@ public class ClassTest { } with(members.elementAt(1)) { assertEquals("fn", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(DocumentationNode.Kind.Function, kind) assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) @@ -111,14 +111,14 @@ public class ClassTest { with(model.members.single().members.single()) { assertEquals(DocumentationNode.Kind.Class, kind) assertEquals("Klass", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(2, details.count()) assertTrue(links.none()) assertEquals(2, members.count()) with(members.elementAt(0)) { assertEquals("", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(DocumentationNode.Kind.Constructor, kind) assertEquals(1, details.count()) assertEquals("public", details.elementAt(0).name) @@ -127,7 +127,7 @@ public class ClassTest { } with(members.elementAt(1)) { assertEquals("name", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(DocumentationNode.Kind.Property, kind) assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt index 9206e386..b2ad0ac0 100644 --- a/test/src/model/CommentTest.kt +++ b/test/src/model/CommentTest.kt @@ -8,7 +8,7 @@ public class CommentTest { Test fun emptyDoc() { verifyModel("test/data/comments/emptyDoc.kt") { model -> with(model.members.single().members.single()) { - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) } } } @@ -16,7 +16,7 @@ public class CommentTest { Test fun emptyDocButComment() { verifyModel("test/data/comments/emptyDocButComment.kt") { model -> with(model.members.single().members.single()) { - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) } } } @@ -24,8 +24,8 @@ public class CommentTest { Test fun multilineDoc() { verifyModel("test/data/comments/multilineDoc.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc1", doc.summary.toTestString()) - assertEquals("doc2\ndoc3\n", doc.description.toTestString()) + assertEquals("doc1", content.summary.toTestString()) + assertEquals("doc2\ndoc3\n", content.description.toTestString()) } } } @@ -33,8 +33,8 @@ public class CommentTest { Test fun multipleDocs() { verifyModel("test/data/comments/multipleDocs.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc1", doc.summary.toTestString()) - assertEquals("doc2\ndoc3", doc.description.toTestString()) + assertEquals("doc1", content.summary.toTestString()) + assertEquals("doc2\ndoc3", content.description.toTestString()) } } } @@ -42,8 +42,8 @@ public class CommentTest { Test fun multilineDocWithComment() { verifyModel("test/data/comments/multilineDocWithComment.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc1", doc.summary.toTestString()) - assertEquals("doc2\ndoc3", doc.description.toTestString()) + assertEquals("doc1", content.summary.toTestString()) + assertEquals("doc2\ndoc3", content.description.toTestString()) } } } @@ -51,7 +51,7 @@ public class CommentTest { Test fun oneLineDoc() { verifyModel("test/data/comments/oneLineDoc.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc", doc.summary.toTestString()) + assertEquals("doc", content.summary.toTestString()) } } } @@ -59,7 +59,7 @@ public class CommentTest { Test fun oneLineDocWithComment() { verifyModel("test/data/comments/oneLineDocWithComment.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc", doc.summary.toTestString()) + assertEquals("doc", content.summary.toTestString()) } } } @@ -67,7 +67,7 @@ public class CommentTest { Test fun oneLineDocWithEmptyLine() { verifyModel("test/data/comments/oneLineDocWithEmptyLine.kt") { model -> with(model.members.single().members.single()) { - assertEquals("doc", doc.summary.toTestString()) + assertEquals("doc", content.summary.toTestString()) } } } @@ -75,9 +75,9 @@ public class CommentTest { Test fun emptySection() { verifyModel("test/data/comments/emptySection.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(2, doc.sections.count()) - with (doc.sections["one"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(2, content.sections.count()) + with (content.sections["one"]!!) { assertEquals("one", label) assertEquals("", toTestString()) } @@ -88,9 +88,9 @@ public class CommentTest { Test fun explicitSummary() { verifyModel("test/data/comments/explicitSummary.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals("Description", doc.description.toTestString()) - assertEquals(2, doc.sections.count()) + assertEquals("Summary", content.summary.toTestString()) + assertEquals("Description", content.description.toTestString()) + assertEquals(2, content.sections.count()) } } } @@ -98,9 +98,9 @@ public class CommentTest { Test fun section1() { verifyModel("test/data/comments/section1.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(2, doc.sections.count()) - with (doc.sections["one"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(2, content.sections.count()) + with (content.sections["one"]!!) { assertEquals("one", label) assertEquals("section one", toTestString()) } @@ -111,13 +111,13 @@ public class CommentTest { Test fun section2() { verifyModel("test/data/comments/section2.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(3, doc.sections.count()) - with (doc.sections["one"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(3, content.sections.count()) + with (content.sections["one"]!!) { assertEquals("one", label) assertEquals("section one", toTestString()) } - with (doc.sections["two"]!!) { + with (content.sections["two"]!!) { assertEquals("two", label) assertEquals("section two", toTestString()) } @@ -128,9 +128,9 @@ public class CommentTest { Test fun sectionOnOneLine() { verifyModel("test/data/comments/sectionOnOneLine.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(2, doc.sections.count()) - with (doc.sections["one"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(2, content.sections.count()) + with (content.sections["one"]!!) { assertEquals("one", label) assertEquals("same line", toTestString()) } @@ -141,9 +141,9 @@ public class CommentTest { Test fun emptySectionOnOneLine() { verifyModel("test/data/comments/emptySectionOnOneLine.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(2, doc.sections.count()) - with (doc.sections["one"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(2, content.sections.count()) + with (content.sections["one"]!!) { assertEquals("one", label) assertEquals("", toTestString()) } @@ -154,9 +154,9 @@ public class CommentTest { Test fun multilineSection() { verifyModel("test/data/comments/multilineSection.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(2, doc.sections.count()) - with (doc.sections["one"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(2, content.sections.count()) + with (content.sections["one"]!!) { assertEquals("one", label) assertEquals("""line one line two""", toTestString()) @@ -168,9 +168,9 @@ line two""", toTestString()) Test fun sectionWithBracedLabel() { verifyModel("test/data/comments/sectionWithBracedLabel.kt") { model -> with(model.members.single().members.single()) { - assertEquals("Summary", doc.summary.toTestString()) - assertEquals(2, doc.sections.count()) - with (doc.sections["this.label.is.really.long"]!!) { + assertEquals("Summary", content.summary.toTestString()) + assertEquals(2, content.sections.count()) + with (content.sections["this.label.is.really.long"]!!) { assertEquals("this.label.is.really.long", label) assertEquals("section one", toTestString()) } diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index fe8b6397..c6ad93cc 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -10,7 +10,7 @@ public class FunctionTest { with(model.members.single().members.single()) { assertEquals("fn", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("Function fn", doc.summary.toTestString()) + assertEquals("Function fn", content.summary.toTestString()) assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class FunctionTest { with(model.members.single().members.single()) { assertEquals("fn", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("Function with receiver", doc.summary.toTestString()) + assertEquals("Function with receiver", content.summary.toTestString()) assertEquals("Unit", details.elementAt(0).name) assertEquals(4, details.count()) @@ -32,7 +32,7 @@ public class FunctionTest { with(details.elementAt(3)) { assertEquals("", name) assertEquals(DocumentationNode.Kind.Receiver, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", details.single().name) assertTrue(members.none()) assertTrue(links.none()) @@ -48,7 +48,7 @@ public class FunctionTest { with(model.members.single().members.single()) { assertEquals("generic", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("generic function", doc.summary.toTestString()) + assertEquals("generic function", content.summary.toTestString()) assertEquals(4, details.count()) assertEquals("Unit", details.elementAt(0).name) @@ -57,7 +57,7 @@ public class FunctionTest { with(details.elementAt(3)) { assertEquals("T", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -73,7 +73,7 @@ public class FunctionTest { with(model.members.single().members.single()) { assertEquals("generic", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("generic function", doc.summary.toTestString()) + assertEquals("generic function", content.summary.toTestString()) assertEquals(5, details.count()) assertEquals("Unit", details.elementAt(0).name) @@ -82,11 +82,11 @@ public class FunctionTest { with(details.elementAt(3)) { assertEquals("T", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) with(details.single()) { assertEquals("R", name) assertEquals(DocumentationNode.Kind.UpperBound, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -97,7 +97,7 @@ public class FunctionTest { with(details.elementAt(4)) { assertEquals("R", name) assertEquals(DocumentationNode.Kind.TypeParameter, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(members.none()) assertTrue(links.none()) } @@ -113,9 +113,9 @@ public class FunctionTest { with(model.members.single().members.single()) { assertEquals("function", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("Multiline", doc.summary.toTestString()) + assertEquals("Multiline", content.summary.toTestString()) assertEquals("""Function -Documentation""", doc.description.toTestString()) +Documentation""", content.description.toTestString()) assertEquals(4, details.count()) assertEquals("Unit", details.elementAt(0).name) @@ -124,7 +124,7 @@ Documentation""", doc.description.toTestString()) with(details.elementAt(3)) { assertEquals("x", name) assertEquals(DocumentationNode.Kind.Parameter, kind) - assertEquals("parameter", doc.summary.toTestString()) + assertEquals("parameter", content.summary.toTestString()) assertEquals("Int", details.single().name) assertTrue(members.none()) assertTrue(links.none()) diff --git a/test/src/model/JavaTest.kt b/test/src/model/JavaTest.kt index 2fd197d5..e57be4a9 100644 --- a/test/src/model/JavaTest.kt +++ b/test/src/model/JavaTest.kt @@ -11,7 +11,7 @@ public class JavaTest { with(pkg.members.single()) { assertEquals("fn", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals("Function fn", doc.summary) + assertEquals("Function fn", content.summary) assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) diff --git a/test/src/model/PackageTest.kt b/test/src/model/PackageTest.kt index 848fff3e..1f1a6ebf 100644 --- a/test/src/model/PackageTest.kt +++ b/test/src/model/PackageTest.kt @@ -10,7 +10,7 @@ public class PackageTest { with(model.members.single()) { assertEquals(DocumentationNode.Kind.Package, kind) assertEquals("", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class PackageTest { with(model.members.single()) { assertEquals(DocumentationNode.Kind.Package, kind) assertEquals("simple", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -36,7 +36,7 @@ public class PackageTest { with(model.members.single()) { assertEquals(DocumentationNode.Kind.Package, kind) assertEquals("dot.name", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -50,14 +50,14 @@ public class PackageTest { with(model.members.single { it.name == "simple" }) { assertEquals(DocumentationNode.Kind.Package, kind) assertEquals("simple", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) } with(model.members.single { it.name == "dot.name" }) { assertEquals(DocumentationNode.Kind.Package, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) @@ -71,7 +71,7 @@ public class PackageTest { with(model.members.elementAt(0)) { assertEquals(DocumentationNode.Kind.Package, kind) assertEquals("simple", name) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertTrue(details.none()) assertTrue(members.none()) assertTrue(links.none()) diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index cac62194..93d81769 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -10,7 +10,7 @@ public class PropertyTest { with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) @@ -23,7 +23,7 @@ public class PropertyTest { with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(members.none()) assertTrue(links.none()) @@ -36,13 +36,13 @@ public class PropertyTest { with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) with(members.single()) { assertEquals("", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) assertTrue(members.none()) @@ -56,7 +56,7 @@ public class PropertyTest { with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNode.Kind.Property, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(3, details.count()) assertEquals("String", detail(DocumentationNode.Kind.Type).name) val modifiers = details(DocumentationNode.Kind.Modifier).map { it.name } @@ -68,7 +68,7 @@ public class PropertyTest { with(members.elementAt(0)) { assertEquals("", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) val get_modifiers = details(DocumentationNode.Kind.Modifier).map { it.name } assertTrue("final" in get_modifiers) assertTrue("internal" in get_modifiers) @@ -79,7 +79,7 @@ public class PropertyTest { with(members.elementAt(1)) { assertEquals("", name) assertEquals(DocumentationNode.Kind.Function, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals(4, details.count()) assertEquals("Unit", detail(DocumentationNode.Kind.Type).name) val set_modifiers = details(DocumentationNode.Kind.Modifier).map { it.name } @@ -88,7 +88,7 @@ public class PropertyTest { with(detail(DocumentationNode.Kind.Parameter)) { assertEquals("value", name) assertEquals(DocumentationNode.Kind.Parameter, kind) - assertEquals(Content.Empty, doc) + assertEquals(Content.Empty, content) assertEquals("String", detail(DocumentationNode.Kind.Type).name) assertTrue(links.none()) assertTrue(members.none()) -- cgit