diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-10-29 18:45:33 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2018-10-29 18:46:41 +0300 |
commit | b9fa0e0741bfdfa76c3929e5343a2b19d96fc1ff (patch) | |
tree | 09a07123c9c6437333f9faad7f4e1c2154aa07f2 /core/src/test | |
parent | 8f32ef92be19c88f1a26d3ce19f77c9e1d053d8d (diff) | |
download | dokka-b9fa0e0741bfdfa76c3929e5343a2b19d96fc1ff.tar.gz dokka-b9fa0e0741bfdfa76c3929e5343a2b19d96fc1ff.tar.bz2 dokka-b9fa0e0741bfdfa76c3929e5343a2b19d96fc1ff.zip |
#361: Fix varargs
Fix #361
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/kotlin/javadoc/JavadocTest.kt | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt index 45c45aa4..34b0b7a5 100644 --- a/core/src/test/kotlin/javadoc/JavadocTest.kt +++ b/core/src/test/kotlin/javadoc/JavadocTest.kt @@ -64,7 +64,7 @@ class JavadocTest { val member = classDoc.methods().find { it.name() == "main" }!! val paramType = member.parameters()[0].type() assertNull(paramType.asParameterizedType()) - assertEquals("String", paramType.typeName()) + assertEquals("String[]", paramType.typeName()) assertEquals("String", paramType.asClassDoc().name()) } } @@ -161,6 +161,22 @@ class JavadocTest { } } + @Test + fun testVararg() { + verifyJavadoc("testdata/javadoc/vararg.kt") { doc -> + val classDoc = doc.classNamed("VarargKt")!! + val methods = classDoc.methods() + methods.single { it.name() == "vararg" }.let { method -> + assertTrue(method.isVarArgs) + assertEquals("int", method.parameters().last().typeName()) + } + methods.single { it.name() == "varargInMiddle" }.let { method -> + assertFalse(method.isVarArgs) + assertEquals("int[]", method.parameters()[1].typeName()) + } + } + } + private fun verifyJavadoc(name: String, withJdk: Boolean = false, withKotlinRuntime: Boolean = false, |