aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/model/PackageTest.kt
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-12-03 16:22:11 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-12-03 16:22:49 +0100
commit39631054c58df5841ea268b7002b820ec55f6e0a (patch)
treecefedd8411c859243bd181568e16fcdd372a38c8 /core/src/test/kotlin/model/PackageTest.kt
parent797cb4732c53bf1e3b2091add8cf731fc436607f (diff)
downloaddokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.gz
dokka-39631054c58df5841ea268b7002b820ec55f6e0a.tar.bz2
dokka-39631054c58df5841ea268b7002b820ec55f6e0a.zip
restructure Dokka build to use Gradle for everything except for the Maven plugin
Diffstat (limited to 'core/src/test/kotlin/model/PackageTest.kt')
-rw-r--r--core/src/test/kotlin/model/PackageTest.kt86
1 files changed, 86 insertions, 0 deletions
diff --git a/core/src/test/kotlin/model/PackageTest.kt b/core/src/test/kotlin/model/PackageTest.kt
new file mode 100644
index 00000000..aa5a059a
--- /dev/null
+++ b/core/src/test/kotlin/model/PackageTest.kt
@@ -0,0 +1,86 @@
+package org.jetbrains.dokka.tests
+
+import org.jetbrains.dokka.Content
+import org.jetbrains.dokka.DocumentationNode
+import org.jetbrains.kotlin.config.KotlinSourceRoot
+import org.junit.Test
+import kotlin.test.assertEquals
+import kotlin.test.assertTrue
+
+public class PackageTest {
+ @Test fun rootPackage() {
+ verifyModel("testdata/packages/rootPackage.kt") { model ->
+ with(model.members.single()) {
+ assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals("", name)
+ assertEquals(Content.Empty, content)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+
+ @Test fun simpleNamePackage() {
+ verifyModel("testdata/packages/simpleNamePackage.kt") { model ->
+ with(model.members.single()) {
+ assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals("simple", name)
+ assertEquals(Content.Empty, content)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+
+ @Test fun dottedNamePackage() {
+ verifyModel("testdata/packages/dottedNamePackage.kt") { model ->
+ with(model.members.single()) {
+ assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals("dot.name", name)
+ assertEquals(Content.Empty, content)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+
+ @Test fun multipleFiles() {
+ verifyModel(KotlinSourceRoot("testdata/packages/dottedNamePackage.kt"),
+ KotlinSourceRoot("testdata/packages/simpleNamePackage.kt")) { model ->
+ assertEquals(2, model.members.count())
+ with(model.members.single { it.name == "simple" }) {
+ assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals("simple", name)
+ 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, content)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+
+ @Test fun multipleFilesSamePackage() {
+ verifyModel(KotlinSourceRoot("testdata/packages/simpleNamePackage.kt"),
+ KotlinSourceRoot("testdata/packages/simpleNamePackage2.kt")) { model ->
+ assertEquals(1, model.members.count())
+ with(model.members.elementAt(0)) {
+ assertEquals(DocumentationNode.Kind.Package, kind)
+ assertEquals("simple", name)
+ assertEquals(Content.Empty, content)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+} \ No newline at end of file