diff options
-rw-r--r-- | core/src/test/kotlin/javadoc/JavadocTest.kt | 17 | ||||
-rw-r--r-- | core/testdata/javadoc/typealiases.kt | 11 |
2 files changed, 28 insertions, 0 deletions
diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt index 41d22b47..4c0f7f0f 100644 --- a/core/src/test/kotlin/javadoc/JavadocTest.kt +++ b/core/src/test/kotlin/javadoc/JavadocTest.kt @@ -1,5 +1,6 @@ package org.jetbrains.dokka.javadoc +import com.sun.javadoc.Type import org.jetbrains.dokka.DokkaConsoleLogger import org.jetbrains.dokka.tests.verifyModel import org.junit.Assert.* @@ -107,6 +108,22 @@ class JavadocTest { } } + @Test fun testTypeAliases() { + verifyJavadoc("testdata/javadoc/typealiases.kt", withKotlinRuntime = true) { doc -> + assertNull(doc.classNamed("B")) + assertNull(doc.classNamed("D")) + + assertEquals("A", doc.classNamed("C")!!.superclass().name()) + val methodParamType = doc.classNamed("TypealiasesKt")!!.methods() + .find { it.name() == "some" }!!.parameters().first() + .type() + assertEquals("kotlin.jvm.functions.Function1", methodParamType.qualifiedTypeName()) + assertEquals("? super A, C", methodParamType.asParameterizedType().typeArguments() + .map(Type::qualifiedTypeName).joinToString()) + } + } + + private fun verifyJavadoc(name: String, withJdk: Boolean = false, withKotlinRuntime: Boolean = false, diff --git a/core/testdata/javadoc/typealiases.kt b/core/testdata/javadoc/typealiases.kt new file mode 100644 index 00000000..bb09bfad --- /dev/null +++ b/core/testdata/javadoc/typealiases.kt @@ -0,0 +1,11 @@ +class A + +typealias B = A + +class C : B + +typealias D = (A) -> C + +fun some(d: D) { + +}
\ No newline at end of file |