diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-05 15:51:23 +0100 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2015-11-05 15:51:23 +0100 |
commit | b643bf6f4b4c29676ce3301d92b7880b268d6722 (patch) | |
tree | 8f0fede2d5eac2110ca4687a35eefb8727ed4d7e /javadoc/src/test | |
parent | 0bad64896baed4056d75f8b948afe0d848bc8adf (diff) | |
download | dokka-b643bf6f4b4c29676ce3301d92b7880b268d6722.tar.gz dokka-b643bf6f4b4c29676ce3301d92b7880b268d6722.tar.bz2 dokka-b643bf6f4b4c29676ce3301d92b7880b268d6722.zip |
add tests; fixes related to qualified names of types
Diffstat (limited to 'javadoc/src/test')
-rw-r--r-- | javadoc/src/test/data/obj.kt | 7 | ||||
-rw-r--r-- | javadoc/src/test/data/types.kt | 4 | ||||
-rw-r--r-- | javadoc/src/test/kotlin/JavadocTest.kt | 44 |
3 files changed, 55 insertions, 0 deletions
diff --git a/javadoc/src/test/data/obj.kt b/javadoc/src/test/data/obj.kt new file mode 100644 index 00000000..1d10a422 --- /dev/null +++ b/javadoc/src/test/data/obj.kt @@ -0,0 +1,7 @@ +package foo + +class O { + companion object { + + } +} diff --git a/javadoc/src/test/data/types.kt b/javadoc/src/test/data/types.kt new file mode 100644 index 00000000..55be6058 --- /dev/null +++ b/javadoc/src/test/data/types.kt @@ -0,0 +1,4 @@ +package foo + +fun foo(x: Int, o: Any): String { +} diff --git a/javadoc/src/test/kotlin/JavadocTest.kt b/javadoc/src/test/kotlin/JavadocTest.kt new file mode 100644 index 00000000..1ac7069b --- /dev/null +++ b/javadoc/src/test/kotlin/JavadocTest.kt @@ -0,0 +1,44 @@ +package org.jetbrains.dokka.javadoc + +import org.jetbrains.dokka.DokkaConsoleLogger +import org.jetbrains.dokka.tests.verifyModel +import org.junit.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNotNull +import kotlin.test.assertTrue + +class JavadocTest { + @Test fun testTypes() { + verifyModel("javadoc/src/test/data/types.kt", format = "javadoc", withJdk = true) { model -> + val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") + val classDoc = doc.classNamed("foo.TypesKt")!! + val method = classDoc.methods().find { it.name() == "foo" }!! + + val type = method.returnType() + assertFalse(type.asClassDoc().isIncluded) + assertEquals("java.lang.String", type.qualifiedTypeName()) + assertEquals("java.lang.String", type.asClassDoc().qualifiedName()) + + val params = method.parameters() + assertTrue(params[0].type().isPrimitive) + assertFalse(params[1].type().asClassDoc().isIncluded) + } + } + + @Test fun testObject() { + verifyModel("javadoc/src/test/data/obj.kt", format = "javadoc") { model -> + val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") + + val classDoc = doc.classNamed("foo.O") + assertNotNull(classDoc) + + val companionDoc = doc.classNamed("foo.O.Companion") + assertNotNull(companionDoc) + + val pkgDoc = doc.packageNamed("foo")!! + assertEquals(2, pkgDoc.allClasses().size) + } + } + +} |