aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIlya Ryzhenkov <orangy@jetbrains.com>2014-07-11 19:23:45 +0400
committerIlya Ryzhenkov <orangy@jetbrains.com>2014-07-11 19:23:45 +0400
commit484ec26c7d22f4d84b7054b9e243b422acaff3dd (patch)
tree18027117a60c38ba7f8800c8c1abdcde1ae38b19 /test
parent35b64fb01d6b4da4b0dab840a787abc84d1bff06 (diff)
downloaddokka-484ec26c7d22f4d84b7054b9e243b422acaff3dd.tar.gz
dokka-484ec26c7d22f4d84b7054b9e243b422acaff3dd.tar.bz2
dokka-484ec26c7d22f4d84b7054b9e243b422acaff3dd.zip
Add tests for packages, implement simple comment text extraction, build model for functions and parameters.
Diffstat (limited to 'test')
-rw-r--r--test/data/functions/function.kt2
-rw-r--r--test/data/functions/functionWithParams.kt4
-rw-r--r--test/data/packages/dottedNamePackage.kt1
-rw-r--r--test/data/packages/rootPackage.kt0
-rw-r--r--test/data/packages/simpleNamePackage.kt1
-rw-r--r--test/src/PackageTest.kt43
-rw-r--r--test/src/TopLevelFunctionTest.kt8
7 files changed, 55 insertions, 4 deletions
diff --git a/test/data/functions/function.kt b/test/data/functions/function.kt
index 878b017b..f8c64f94 100644
--- a/test/data/functions/function.kt
+++ b/test/data/functions/function.kt
@@ -1,4 +1,4 @@
/**
- * doc
+ * Function fn
*/
fun fn() {} \ No newline at end of file
diff --git a/test/data/functions/functionWithParams.kt b/test/data/functions/functionWithParams.kt
index 9d3a0ad7..135ed399 100644
--- a/test/data/functions/functionWithParams.kt
+++ b/test/data/functions/functionWithParams.kt
@@ -1,4 +1,6 @@
/**
- * doc
+ * Multiline
+ * Function
+ * Documentation
*/
fun function(x : Int) {} \ No newline at end of file
diff --git a/test/data/packages/dottedNamePackage.kt b/test/data/packages/dottedNamePackage.kt
new file mode 100644
index 00000000..38619310
--- /dev/null
+++ b/test/data/packages/dottedNamePackage.kt
@@ -0,0 +1 @@
+package dot.name \ No newline at end of file
diff --git a/test/data/packages/rootPackage.kt b/test/data/packages/rootPackage.kt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/data/packages/rootPackage.kt
diff --git a/test/data/packages/simpleNamePackage.kt b/test/data/packages/simpleNamePackage.kt
new file mode 100644
index 00000000..2c29f4c7
--- /dev/null
+++ b/test/data/packages/simpleNamePackage.kt
@@ -0,0 +1 @@
+package simple
diff --git a/test/src/PackageTest.kt b/test/src/PackageTest.kt
new file mode 100644
index 00000000..411ea300
--- /dev/null
+++ b/test/src/PackageTest.kt
@@ -0,0 +1,43 @@
+package com.jetbrains.dokka.tests
+
+import org.junit.Test
+import kotlin.test.*
+import com.jetbrains.dokka.*
+
+public class PackageTest {
+ Test fun rootPackage() {
+ verifyFiles("test/data/packages/rootPackage.kt") { model ->
+ val item = model.nodes.single()
+ assertEquals(DocumentationNodeKind.Package, item.kind)
+ assertEquals("", item.name)
+ assertEquals("", item.doc)
+ assertTrue(item.details.none())
+ assertTrue(item.members.none())
+ assertTrue(item.links.none())
+ }
+ }
+
+ Test fun simpleNamePackage() {
+ verifyFiles("test/data/packages/simpleNamePackage.kt") { model ->
+ val item = model.nodes.single()
+ assertEquals(DocumentationNodeKind.Package, item.kind)
+ assertEquals("simple", item.name)
+ assertEquals("", item.doc)
+ assertTrue(item.details.none())
+ assertTrue(item.members.none())
+ assertTrue(item.links.none())
+ }
+ }
+
+ Test fun dottedNamePackage() {
+ verifyFiles("test/data/packages/dottedNamePackage.kt") { model ->
+ val item = model.nodes.single()
+ assertEquals(DocumentationNodeKind.Package, item.kind)
+ assertEquals("dot.name", item.name)
+ assertEquals("", item.doc)
+ assertTrue(item.details.none())
+ assertTrue(item.members.none())
+ assertTrue(item.links.none())
+ }
+ }
+} \ No newline at end of file
diff --git a/test/src/TopLevelFunctionTest.kt b/test/src/TopLevelFunctionTest.kt
index dd88a1a0..02150784 100644
--- a/test/src/TopLevelFunctionTest.kt
+++ b/test/src/TopLevelFunctionTest.kt
@@ -11,7 +11,7 @@ public class TopLevelFunctionTest {
val item = model.nodes.single().members.single()
assertEquals(DocumentationNodeKind.Function, item.kind)
assertEquals("fn", item.name)
- assertEquals("doc", item.doc)
+ assertEquals("Function fn", item.doc)
assertTrue(item.details.none())
assertTrue(item.members.none())
assertTrue(item.links.none())
@@ -23,8 +23,12 @@ public class TopLevelFunctionTest {
val item = model.nodes.single().members.single()
assertEquals(DocumentationNodeKind.Function, item.kind)
assertEquals("function", item.name)
- assertEquals("doc", item.doc)
+ assertEquals("""Multiline
+Function
+Documentation"""
+ , item.doc)
assertEquals("x", item.details.single().name)
+ assertEquals(DocumentationNodeKind.Parameter, item.details.single().kind)
assertTrue(item.members.none())
assertTrue(item.links.none())