diff options
author | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-12 15:00:35 +0400 |
---|---|---|
committer | Ilya Ryzhenkov <orangy@jetbrains.com> | 2014-07-12 15:00:35 +0400 |
commit | 9ebe89742ccf29bb7efb6198666bd968397320e0 (patch) | |
tree | 6a4ccb8dfb0e0f64fa8dae57963c6af3c99e5fc6 /test/src/model | |
parent | 16391ddfa1e069bbfe1b9b2c9ac2d985ce107fcb (diff) | |
download | dokka-9ebe89742ccf29bb7efb6198666bd968397320e0.tar.gz dokka-9ebe89742ccf29bb7efb6198666bd968397320e0.tar.bz2 dokka-9ebe89742ccf29bb7efb6198666bd968397320e0.zip |
Add test for multiple files generating multiple package nodes, rename nodes->members in Module
Diffstat (limited to 'test/src/model')
-rw-r--r-- | test/src/model/ClassTest.kt | 12 | ||||
-rw-r--r-- | test/src/model/CommentTest.kt | 30 | ||||
-rw-r--r-- | test/src/model/FunctionTest.kt | 10 | ||||
-rw-r--r-- | test/src/model/PackageTest.kt | 28 | ||||
-rw-r--r-- | test/src/model/PropertyTest.kt | 8 |
5 files changed, 55 insertions, 33 deletions
diff --git a/test/src/model/ClassTest.kt b/test/src/model/ClassTest.kt index d5953811..10eda003 100644 --- a/test/src/model/ClassTest.kt +++ b/test/src/model/ClassTest.kt @@ -7,7 +7,7 @@ import org.jetbrains.dokka.* public class ClassTest { Test fun emptyClass() { verifyModel("test/data/classes/emptyClass.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) @@ -20,7 +20,7 @@ public class ClassTest { Test fun gnClass() { verifyModel("test/data/classes/emptyClass.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) @@ -33,7 +33,7 @@ public class ClassTest { Test fun emptyObject() { verifyModel("test/data/classes/emptyObject.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationNodeKind.Object, kind) assertEquals("Obj", name) assertEquals(DocumentationContent.Empty, doc) @@ -46,7 +46,7 @@ public class ClassTest { Test fun classWithConstructor() { verifyModel("test/data/classes/classWithConstructor.kt") { model -> - with (model.nodes.single().members.single()) { + with (model.members.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) @@ -76,7 +76,7 @@ public class ClassTest { Test fun classWithFunction() { verifyModel("test/data/classes/classWithFunction.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) @@ -106,7 +106,7 @@ public class ClassTest { Test fun classWithProperty() { verifyModel("test/data/classes/classWithProperty.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationNodeKind.Class, kind) assertEquals("Klass", name) assertEquals(DocumentationContent.Empty, doc) diff --git a/test/src/model/CommentTest.kt b/test/src/model/CommentTest.kt index b30cfbf4..905aeaaf 100644 --- a/test/src/model/CommentTest.kt +++ b/test/src/model/CommentTest.kt @@ -7,7 +7,7 @@ import org.jetbrains.dokka.* public class CommentTest { Test fun emptyDoc() { verifyModel("test/data/comments/emptyDoc.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationContent.Empty, doc) } } @@ -15,7 +15,7 @@ public class CommentTest { Test fun emptyDocButComment() { verifyModel("test/data/comments/emptyDocButComment.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals(DocumentationContent.Empty, doc) } } @@ -23,7 +23,7 @@ public class CommentTest { Test fun multilineDoc() { verifyModel("test/data/comments/multilineDoc.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("""doc1 doc2 doc3""", doc.summary) @@ -33,7 +33,7 @@ doc3""", doc.summary) Test fun multipleDocs() { verifyModel("test/data/comments/multipleDocs.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("""doc1 doc2 doc3""", doc.summary) @@ -43,7 +43,7 @@ doc3""", doc.summary) Test fun multilineDocWithComment() { verifyModel("test/data/comments/multilineDocWithComment.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("""doc1 doc2 doc3""", doc.summary) @@ -53,7 +53,7 @@ doc3""", doc.summary) Test fun oneLineDoc() { verifyModel("test/data/comments/oneLineDoc.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("doc", doc.summary) } } @@ -61,7 +61,7 @@ doc3""", doc.summary) Test fun oneLineDocWithComment() { verifyModel("test/data/comments/oneLineDocWithComment.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("doc", doc.summary) } } @@ -69,7 +69,7 @@ doc3""", doc.summary) Test fun oneLineDocWithEmptyLine() { verifyModel("test/data/comments/oneLineDocWithEmptyLine.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("doc", doc.summary) } } @@ -77,7 +77,7 @@ doc3""", doc.summary) Test fun emptySection() { verifyModel("test/data/comments/emptySection.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(1, doc.sections.count()) with (doc.sections.elementAt(0)) { @@ -90,7 +90,7 @@ doc3""", doc.summary) Test fun section1() { verifyModel("test/data/comments/section1.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(1, doc.sections.count()) with (doc.sections.elementAt(0)) { @@ -103,7 +103,7 @@ doc3""", doc.summary) Test fun section2() { verifyModel("test/data/comments/section2.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(2, doc.sections.count()) with (doc.sections.elementAt(0)) { @@ -120,7 +120,7 @@ doc3""", doc.summary) Test fun sectionOnOneLine() { verifyModel("test/data/comments/sectionOnOneLine.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(1, doc.sections.count()) with (doc.sections.elementAt(0)) { @@ -133,7 +133,7 @@ doc3""", doc.summary) Test fun emptySectionOnOneLine() { verifyModel("test/data/comments/emptySectionOnOneLine.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(1, doc.sections.count()) with (doc.sections.elementAt(0)) { @@ -146,7 +146,7 @@ doc3""", doc.summary) Test fun multilineSection() { verifyModel("test/data/comments/multilineSection.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(1, doc.sections.count()) with (doc.sections.elementAt(0)) { @@ -160,7 +160,7 @@ line two""", text) Test fun sectionWithBracedLabel() { verifyModel("test/data/comments/sectionWithBracedLabel.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("Summary", doc.summary) assertEquals(1, doc.sections.count()) with (doc.sections.elementAt(0)) { diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt index 5499b21b..5309ff89 100644 --- a/test/src/model/FunctionTest.kt +++ b/test/src/model/FunctionTest.kt @@ -7,7 +7,7 @@ import org.jetbrains.dokka.* public class FunctionTest { Test fun function() { verifyModel("test/data/functions/function.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("fn", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("Function fn", doc.summary) @@ -20,7 +20,7 @@ public class FunctionTest { Test fun functionWithReceiver() { verifyModel("test/data/functions/functionWithReceiver.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("fn", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("Function with receiver", doc.summary) @@ -43,7 +43,7 @@ public class FunctionTest { Test fun genericFunction() { verifyModel("test/data/functions/genericFunction.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("generic", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("generic function", doc.summary) @@ -66,7 +66,7 @@ public class FunctionTest { } Test fun genericFunctionWithConstraints() { verifyModel("test/data/functions/genericFunctionWithConstraints.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("generic", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("generic function", doc.summary) @@ -104,7 +104,7 @@ public class FunctionTest { Test fun functionWithParams() { verifyModel("test/data/functions/functionWithParams.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("function", name) assertEquals(DocumentationNodeKind.Function, kind) assertEquals("""Multiline diff --git a/test/src/model/PackageTest.kt b/test/src/model/PackageTest.kt index d95b799a..1cb9efa8 100644 --- a/test/src/model/PackageTest.kt +++ b/test/src/model/PackageTest.kt @@ -7,7 +7,7 @@ import org.jetbrains.dokka.* public class PackageTest { Test fun rootPackage() { verifyModel("test/data/packages/rootPackage.kt") { model -> - with(model.nodes.single()) { + with(model.members.single()) { assertEquals(DocumentationNodeKind.Package, kind) assertEquals("", name) assertEquals(DocumentationContent.Empty, doc) @@ -20,7 +20,7 @@ public class PackageTest { Test fun simpleNamePackage() { verifyModel("test/data/packages/simpleNamePackage.kt") { model -> - with(model.nodes.single()) { + with(model.members.single()) { assertEquals(DocumentationNodeKind.Package, kind) assertEquals("simple", name) assertEquals(DocumentationContent.Empty, doc) @@ -33,7 +33,29 @@ public class PackageTest { Test fun dottedNamePackage() { verifyModel("test/data/packages/dottedNamePackage.kt") { model -> - with(model.nodes.single()) { + with(model.members.single()) { + assertEquals(DocumentationNodeKind.Package, kind) + assertEquals("dot.name", name) + assertEquals(DocumentationContent.Empty, doc) + assertTrue(details.none()) + assertTrue(members.none()) + assertTrue(links.none()) + } + } + } + + Test fun multipleFiles() { + verifyModel("test/data/packages/dottedNamePackage.kt", "test/data/packages/simpleNamePackage.kt") { model -> + assertEquals(2, model.members.count()) + with(model.members.elementAt(0)) { + assertEquals(DocumentationNodeKind.Package, kind) + assertEquals("simple", name) + assertEquals(DocumentationContent.Empty, doc) + assertTrue(details.none()) + assertTrue(members.none()) + assertTrue(links.none()) + } + with(model.members.elementAt(1)) { assertEquals(DocumentationNodeKind.Package, kind) assertEquals("dot.name", name) assertEquals(DocumentationContent.Empty, doc) diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt index f005d20d..f810e4ed 100644 --- a/test/src/model/PropertyTest.kt +++ b/test/src/model/PropertyTest.kt @@ -7,7 +7,7 @@ import org.jetbrains.dokka.* public class PropertyTest { Test fun valueProperty() { verifyModel("test/data/properties/valueProperty.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals(DocumentationContent.Empty, doc) @@ -20,7 +20,7 @@ public class PropertyTest { Test fun variableProperty() { verifyModel("test/data/properties/variableProperty.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals(DocumentationContent.Empty, doc) @@ -33,7 +33,7 @@ public class PropertyTest { Test fun valuePropertyWithGetter() { verifyModel("test/data/properties/valuePropertyWithGetter.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals(DocumentationContent.Empty, doc) @@ -53,7 +53,7 @@ public class PropertyTest { Test fun variablePropertyWithAccessors() { verifyModel("test/data/properties/variablePropertyWithAccessors.kt") { model -> - with(model.nodes.single().members.single()) { + with(model.members.single().members.single()) { assertEquals("property", name) assertEquals(DocumentationNodeKind.Property, kind) assertEquals(DocumentationContent.Empty, doc) |