Add a test for dac-as-java format
Test: tested in IDE
Change-Id: Ibb46ceb7e4bedd10317094776a058696819d246e
diff --git a/core/src/test/kotlin/TestAPI.kt b/core/src/test/kotlin/TestAPI.kt
index 1a2b114..ef2923c 100644
--- a/core/src/test/kotlin/TestAPI.kt
+++ b/core/src/test/kotlin/TestAPI.kt
@@ -138,12 +138,13 @@
fun verifyJavaModel(source: String,
withKotlinRuntime: Boolean = false,
+ format: String = "html",
verifier: (DocumentationModule) -> Unit) {
val tempDir = FileUtil.createTempDirectory("dokka", "")
try {
val sourceFile = File(source)
FileUtil.copy(sourceFile, File(tempDir, sourceFile.name))
- verifyModel(JavaSourceRoot(tempDir, null), withJdk = true, withKotlinRuntime = withKotlinRuntime, verifier = verifier)
+ verifyModel(JavaSourceRoot(tempDir, null), format = format, withJdk = true, withKotlinRuntime = withKotlinRuntime, verifier = verifier)
}
finally {
FileUtil.delete(tempDir)
@@ -219,8 +220,9 @@
fun verifyJavaOutput(path: String,
outputExtension: String,
withKotlinRuntime: Boolean = false,
+ format: String = "html",
outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
- verifyJavaModel(path, withKotlinRuntime) { model ->
+ verifyJavaModel(path, withKotlinRuntime, format) { model ->
verifyModelOutput(model, outputExtension, path, outputGenerator)
}
}
diff --git a/core/src/test/kotlin/format/DacAsJavaFormatTest.kt b/core/src/test/kotlin/format/DacAsJavaFormatTest.kt
new file mode 100644
index 0000000..8fc9478
--- /dev/null
+++ b/core/src/test/kotlin/format/DacAsJavaFormatTest.kt
@@ -0,0 +1,29 @@
+package org.jetbrains.dokka.tests.format
+
+import org.jetbrains.dokka.*
+import org.jetbrains.dokka.tests.FileGeneratorTestCase
+import org.jetbrains.dokka.tests.verifyJavaOutput
+import org.jetbrains.dokka.tests.verifyOutput
+import org.junit.Test
+
+class DacAsJavaFormatTest: FileGeneratorTestCase() {
+ override val formatService = HtmlFormatService(fileGenerator, KotlinLanguageService(), HtmlTemplateService.default(), listOf())
+
+ @Test fun javaSeeTag() {
+ verifyJavaHtmlNode("javaSeeTag")
+ }
+
+ private fun verifyJavaHtmlNode(fileName: String, withKotlinRuntime: Boolean = false) {
+ verifyJavaHtmlNodes(fileName, withKotlinRuntime) { model -> model.members.single().members }
+ }
+
+ private fun verifyJavaHtmlNodes(fileName: String,
+ withKotlinRuntime: Boolean = false,
+ format: String = "dac-as-java",
+ nodeFilter: (DocumentationModule) -> List<DocumentationNode>
+ ) {
+ verifyJavaOutput("testdata/format/dac-as-java/$fileName.java",".html", format = format, withKotlinRuntime = withKotlinRuntime) { model, output ->
+ buildPagesAndReadInto(nodeFilter(model), output)
+ }
+ }
+}
\ No newline at end of file
diff --git a/core/testdata/format/dac-as-java/javaSeeTag.html b/core/testdata/format/dac-as-java/javaSeeTag.html
new file mode 100644
index 0000000..90670a3
--- /dev/null
+++ b/core/testdata/format/dac-as-java/javaSeeTag.html
@@ -0,0 +1,26 @@
+<HTML>
+<HEAD>
+<meta charset="UTF-8">
+<title>Foo - test</title>
+</HEAD>
+<BODY>
+<a href="../index.html">test</a> / <a href="./index.html">Foo</a><br/>
+<br/>
+<h1>Foo</h1>
+<code><span class="keyword">class </span><span class="identifier">Foo</span> <span class="symbol">:</span> <span class="identifier">java.lang.Object</span></code>
+<p><strong>See Also</strong><br/>
+<a href="bar.html">#bar</a></p>
+<h3>Functions</h3>
+<table>
+<tbody>
+<tr>
+<td>
+<p><a href="bar.html">bar</a></p>
+</td>
+<td>
+<code><span class="keyword">fun </span><span class="identifier">bar</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">void</span></code></td>
+</tr>
+</tbody>
+</table>
+</BODY>
+</HTML>
diff --git a/core/testdata/format/dac-as-java/javaSeeTag.java b/core/testdata/format/dac-as-java/javaSeeTag.java
new file mode 100644
index 0000000..94a2460
--- /dev/null
+++ b/core/testdata/format/dac-as-java/javaSeeTag.java
@@ -0,0 +1,6 @@
+/**
+ * @see #bar
+ */
+public class Foo {
+ public void bar() {}
+}
\ No newline at end of file