From fc70184fee01430ed9c673336026c6ede8bff5f3 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Wed, 25 Feb 2015 20:06:16 +0100 Subject: working test for cross-language links in documentation (Kotlin class extends Java class) --- test/src/TestAPI.kt | 4 +++- test/src/format/HtmlFormatTest.kt | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'test/src') diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt index 7c6a2e73..6fc83279 100644 --- a/test/src/TestAPI.kt +++ b/test/src/TestAPI.kt @@ -30,6 +30,7 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) -> val stringRoot = PathManager.getResourceRoot(javaClass(), "/java/lang/String.class") addClasspath(File(stringRoot)) addSources(files.toList()) + addClasspath(files.map { File(it)}.filter { it.isDirectory()} ) } val options = DocumentationOptions(includeNonPublic = true, sourceLinks = listOf()) val documentation = buildDocumentationModule(environment, "test", options, logger = DokkaConsoleLogger) @@ -48,7 +49,8 @@ public fun verifyOutput(path: String, outputExtension: String, outputGenerator: verifyModel(path) { val output = StringBuilder() outputGenerator(it, output) - val expectedOutput = File(path.replace(".kt", outputExtension).replace(".java", outputExtension)).readText() + val ext = outputExtension.trimLeading(".") + val expectedOutput = File(path.replaceAfterLast(".", ext, path + "." + ext)).readText() assertEqualsIgnoringSeparators(expectedOutput, output.toString()) } } diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt index 85badf8e..c81b2d85 100644 --- a/test/src/format/HtmlFormatTest.kt +++ b/test/src/format/HtmlFormatTest.kt @@ -117,4 +117,10 @@ public class HtmlFormatTest { htmlService.appendNodes(tempLocation, output, model.members.single().members.single { it.name == "Foo" }.members.filter { it.name == "foo" }) } } + + Test fun crossLanguageKotlinExtendsJava() { + verifyOutput("test/data/format/crossLanguage/kotlinExtendsJava", ".html") { model, output -> + htmlService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == "Bar" }) + } + } } -- cgit