aboutsummaryrefslogtreecommitdiff
path: root/test/src
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-01-09 19:48:44 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-01-09 19:48:44 +0100
commit4b0dcee83efbdb77ae5e389ee04c309c52446153 (patch)
treeed2251d21b2b79985ce958a30e4c238e90f606f9 /test/src
parentc1a1cf14edfcf3b1b0cd166d60cee30e109ffe1a (diff)
downloaddokka-4b0dcee83efbdb77ae5e389ee04c309c52446153.tar.gz
dokka-4b0dcee83efbdb77ae5e389ee04c309c52446153.tar.bz2
dokka-4b0dcee83efbdb77ae5e389ee04c309c52446153.zip
generate ExternalClass nodes to hold extension functions and properties for classes from other packages
Diffstat (limited to 'test/src')
-rw-r--r--test/src/format/MarkdownFormatTest.kt9
-rw-r--r--test/src/model/FunctionTest.kt38
-rw-r--r--test/src/model/PropertyTest.kt13
3 files changed, 45 insertions, 15 deletions
diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt
index 08267d32..3d32743f 100644
--- a/test/src/format/MarkdownFormatTest.kt
+++ b/test/src/format/MarkdownFormatTest.kt
@@ -37,4 +37,13 @@ public class MarkdownFormatTest {
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
+
+ Test fun extensions() {
+ verifyOutput("test/data/format/extensions.kt", ".package.md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members)
+ }
+ verifyOutput("test/data/format/extensions.kt", ".class.md") { model, output ->
+ markdownService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
}
diff --git a/test/src/model/FunctionTest.kt b/test/src/model/FunctionTest.kt
index bf7471ea..299f33a8 100644
--- a/test/src/model/FunctionTest.kt
+++ b/test/src/model/FunctionTest.kt
@@ -21,23 +21,32 @@ public class FunctionTest {
Test fun functionWithReceiver() {
verifyModel("test/data/functions/functionWithReceiver.kt") { model ->
with(model.members.single().members.single()) {
- assertEquals("fn", name)
- assertEquals(DocumentationNode.Kind.Function, kind)
- assertEquals("Function with receiver", content.summary.toTestString())
- assertEquals(4, details.count())
- assertEquals("internal", details.elementAt(0).name)
- assertEquals("final", details.elementAt(1).name)
- with(details.elementAt(2)) {
- assertEquals("<this>", name)
- assertEquals(DocumentationNode.Kind.Receiver, kind)
- assertEquals(Content.Empty, content)
- assertEquals("String", details.single().name)
+ assertEquals("String", name)
+ assertEquals(DocumentationNode.Kind.ExternalClass, kind)
+ assertEquals(2, members.count())
+ with(members[0]) {
+ assertEquals("fn", name)
+ assertEquals(DocumentationNode.Kind.Function, kind)
+ assertEquals("Function with receiver", content.summary.toTestString())
+ assertEquals(4, details.count())
+ assertEquals("internal", details.elementAt(0).name)
+ assertEquals("final", details.elementAt(1).name)
+ with(details.elementAt(2)) {
+ assertEquals("<this>", name)
+ assertEquals(DocumentationNode.Kind.Receiver, kind)
+ assertEquals(Content.Empty, content)
+ assertEquals("String", details.single().name)
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ assertEquals("Unit", details.elementAt(3).name)
assertTrue(members.none())
assertTrue(links.none())
}
- assertEquals("Unit", details.elementAt(3).name)
- assertTrue(members.none())
- assertTrue(links.none())
+ with(members[1]) {
+ assertEquals("fn", name)
+ assertEquals(DocumentationNode.Kind.Function, kind)
+ }
}
}
}
@@ -186,4 +195,3 @@ Documentation""", content.description.toTestString())
}
}
}
-
diff --git a/test/src/model/PropertyTest.kt b/test/src/model/PropertyTest.kt
index 0bf9714d..14c43f78 100644
--- a/test/src/model/PropertyTest.kt
+++ b/test/src/model/PropertyTest.kt
@@ -112,4 +112,17 @@ public class PropertyTest {
}
}
}
+
+ Test fun propertyWithReceiver() {
+ verifyModel("test/data/properties/propertyWithReceiver.kt") { model ->
+ with(model.members.single().members.single()) {
+ assertEquals("String", name)
+ assertEquals(DocumentationNode.Kind.ExternalClass, kind)
+ with(members.single()) {
+ assertEquals("foobar", name)
+ assertEquals(DocumentationNode.Kind.Property, kind)
+ }
+ }
+ }
+ }
}