diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-06-30 15:43:12 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-06-30 15:43:12 +0200 |
commit | 95731338b8fa6560e0d4c5243dce4315f7967d2f (patch) | |
tree | b8b4db119cdeaf2af68d8df3b77b51d86bc802c2 /core/src/test | |
parent | e8f342893413bb1c4d2dc763ccf73a86c1b22488 (diff) | |
download | dokka-95731338b8fa6560e0d4c5243dce4315f7967d2f.tar.gz dokka-95731338b8fa6560e0d4c5243dce4315f7967d2f.tar.bz2 dokka-95731338b8fa6560e0d4c5243dce4315f7967d2f.zip |
add test for @JvmName support in javadoc
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/kotlin/javadoc/JavadocTest.kt | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/core/src/test/kotlin/javadoc/JavadocTest.kt b/core/src/test/kotlin/javadoc/JavadocTest.kt index 8bd520f6..614a786e 100644 --- a/core/src/test/kotlin/javadoc/JavadocTest.kt +++ b/core/src/test/kotlin/javadoc/JavadocTest.kt @@ -7,8 +7,7 @@ import org.junit.Test class JavadocTest { @Test fun testTypes() { - verifyModel("testdata/javadoc/types.kt", format = "javadoc", withJdk = true) { model -> - val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") + verifyJavadoc("testdata/javadoc/types.kt", withJdk = true) { doc -> val classDoc = doc.classNamed("foo.TypesKt")!! val method = classDoc.methods().find { it.name() == "foo" }!! @@ -24,9 +23,7 @@ class JavadocTest { } @Test fun testObject() { - verifyModel("testdata/javadoc/obj.kt", format = "javadoc") { model -> - val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") - + verifyJavadoc("testdata/javadoc/obj.kt") { doc -> val classDoc = doc.classNamed("foo.O") assertNotNull(classDoc) @@ -39,9 +36,7 @@ class JavadocTest { } @Test fun testException() { - verifyModel("testdata/javadoc/exception.kt", format = "javadoc", withKotlinRuntime = true) { model -> - val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") - + verifyJavadoc("testdata/javadoc/exception.kt", withKotlinRuntime = true) { doc -> val classDoc = doc.classNamed("foo.MyException")!! val member = classDoc.methods().find { it.name() == "foo" } assertEquals(classDoc, member!!.containingClass()) @@ -49,9 +44,7 @@ class JavadocTest { } @Test fun testByteArray() { - verifyModel("testdata/javadoc/bytearr.kt", format = "javadoc", withKotlinRuntime = true) { model -> - val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") - + verifyJavadoc("testdata/javadoc/bytearr.kt", withKotlinRuntime = true) { doc -> val classDoc = doc.classNamed("foo.ByteArray")!! assertNotNull(classDoc.asClassDoc()) @@ -61,9 +54,7 @@ class JavadocTest { } @Test fun testStringArray() { - verifyModel("testdata/javadoc/stringarr.kt", format = "javadoc", withKotlinRuntime = true) { model -> - val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") - + verifyJavadoc("testdata/javadoc/stringarr.kt", withKotlinRuntime = true) { doc -> val classDoc = doc.classNamed("foo.Foo")!! assertNotNull(classDoc.asClassDoc()) @@ -74,4 +65,25 @@ class JavadocTest { assertEquals("String", paramType.asClassDoc().name()) } } + + @Test fun testJvmName() { + verifyJavadoc("testdata/javadoc/jvmName.kt", withKotlinRuntime = true) { doc -> + val classDoc = doc.classNamed("foo.Apple")!! + assertNotNull(classDoc.asClassDoc()) + + val member = classDoc.methods().find { it.name() == "_tree" } + assertNotNull(member) + } + } + + private fun verifyJavadoc(name: String, + withJdk: Boolean = false, + withKotlinRuntime: Boolean = false, + callback: (ModuleNodeAdapter) -> Unit) { + + verifyModel(name, format = "javadoc", withJdk = withJdk, withKotlinRuntime = withKotlinRuntime) { model -> + val doc = ModuleNodeAdapter(model, StandardReporter(DokkaConsoleLogger), "") + callback(doc) + } + } } |