aboutsummaryrefslogtreecommitdiff
path: root/core/src/test/kotlin/model
diff options
context:
space:
mode:
authorSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-02-22 14:31:12 +0300
committerSimon Ogorodnik <Simon.Ogorodnik@jetbrains.com>2018-02-22 14:31:12 +0300
commitf37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1 (patch)
treeb9039596c118469ef4f9151eee195a50c0cac4f1 /core/src/test/kotlin/model
parent79a7a136bdc3a59d7bb3aebb51e565b58e2b789c (diff)
parent3eb23215edcd1cf92966f8d39afe754fef0c7a19 (diff)
downloaddokka-f37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1.tar.gz
dokka-f37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1.tar.bz2
dokka-f37d9c3bdd91c5af683eb7eaaf242d7af3d6fcf1.zip
Merge branch 'dev'
Diffstat (limited to 'core/src/test/kotlin/model')
-rw-r--r--core/src/test/kotlin/model/FunctionTest.kt14
-rw-r--r--core/src/test/kotlin/model/PackageTest.kt35
2 files changed, 40 insertions, 9 deletions
diff --git a/core/src/test/kotlin/model/FunctionTest.kt b/core/src/test/kotlin/model/FunctionTest.kt
index 065decef..32910682 100644
--- a/core/src/test/kotlin/model/FunctionTest.kt
+++ b/core/src/test/kotlin/model/FunctionTest.kt
@@ -5,6 +5,7 @@ import org.jetbrains.dokka.NodeKind
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
+import kotlin.test.assertNotNull
class FunctionTest {
@Test fun function() {
@@ -83,9 +84,10 @@ class FunctionTest {
assertEquals(NodeKind.Function, kind)
assertEquals("generic function", content.summary.toTestString())
- assertEquals("public", details.elementAt(0).name)
- assertEquals("final", details.elementAt(1).name)
- with(details.elementAt(3)) {
+ val functionDetails = details
+ assertEquals("public", functionDetails.elementAt(0).name)
+ assertEquals("final", functionDetails.elementAt(1).name)
+ with(functionDetails.elementAt(3)) {
assertEquals("T", name)
assertEquals(NodeKind.TypeParameter, kind)
assertEquals(Content.Empty, content)
@@ -95,19 +97,19 @@ class FunctionTest {
assertEquals(Content.Empty, content)
assertTrue(details.none())
assertTrue(members.none())
- assertTrue(links.none())
+ assertTrue(links.singleOrNull() == functionDetails.elementAt(4))
}
assertTrue(members.none())
assertTrue(links.none())
}
- with(details.elementAt(4)) {
+ with(functionDetails.elementAt(4)) {
assertEquals("R", name)
assertEquals(NodeKind.TypeParameter, kind)
assertEquals(Content.Empty, content)
assertTrue(members.none())
assertTrue(links.none())
}
- assertEquals("Unit", details.elementAt(5).name)
+ assertEquals("Unit", functionDetails.elementAt(5).name)
assertTrue(members.none())
assertTrue(links.none())
diff --git a/core/src/test/kotlin/model/PackageTest.kt b/core/src/test/kotlin/model/PackageTest.kt
index 97810e80..052f0d28 100644
--- a/core/src/test/kotlin/model/PackageTest.kt
+++ b/core/src/test/kotlin/model/PackageTest.kt
@@ -2,10 +2,10 @@ package org.jetbrains.dokka.tests
import org.jetbrains.dokka.Content
import org.jetbrains.dokka.NodeKind
+import org.jetbrains.dokka.PackageOptionsImpl
import org.jetbrains.kotlin.config.KotlinSourceRoot
+import org.junit.Assert.*
import org.junit.Test
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertTrue
public class PackageTest {
@Test fun rootPackage() {
@@ -83,4 +83,33 @@ public class PackageTest {
}
}
}
-} \ No newline at end of file
+
+ @Test fun classAtPackageLevel() {
+ verifyModel(KotlinSourceRoot("testdata/packages/classInPackage.kt")) { model ->
+ assertEquals(1, model.members.count())
+ with(model.members.elementAt(0)) {
+ assertEquals(NodeKind.Package, kind)
+ assertEquals("simple.name", name)
+ assertEquals(Content.Empty, content)
+ assertTrue(details.none())
+ assertEquals(1, members.size)
+ assertTrue(links.none())
+ }
+ }
+ }
+
+ @Test fun suppressAtPackageLevel() {
+ verifyModel(KotlinSourceRoot("testdata/packages/classInPackage.kt"),
+ perPackageOptions = listOf(PackageOptionsImpl(prefix = "simple.name", suppress = true))) { model ->
+ assertEquals(1, model.members.count())
+ with(model.members.elementAt(0)) {
+ assertEquals(NodeKind.Package, kind)
+ assertEquals("simple.name", name)
+ assertEquals(Content.Empty, content)
+ assertTrue(details.none())
+ assertTrue(members.none())
+ assertTrue(links.none())
+ }
+ }
+ }
+}