aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/format/classWithClassObject.html44
-rw-r--r--test/data/format/classWithClassObject.md29
-rw-r--r--test/src/TestAPI.kt7
-rw-r--r--test/src/format/HtmlFormatTest.kt15
-rw-r--r--test/src/format/MarkdownFormatTest.kt4
5 files changed, 67 insertions, 32 deletions
diff --git a/test/data/format/classWithClassObject.html b/test/data/format/classWithClassObject.html
new file mode 100644
index 00000000..79546418
--- /dev/null
+++ b/test/data/format/classWithClassObject.html
@@ -0,0 +1,44 @@
+<HTML>
+<HEAD>
+</HEAD>
+<BODY>
+<a href="out.html">test</a>&nbsp;/&nbsp;<a href="out.html"></a>&nbsp;/&nbsp;<a href="out.html">Klass</a><br/>
+<br/>
+<h1>Klass</h1>
+<pre><code><span class="keyword">class </span><span class="identifier">Klass</span></code></pre><br/>
+<br/>
+<h3>Constructors</h3>
+<table>
+<tbody>
+<tr>
+<td>
+<a href="out.html">&lt;init&gt;</a></td>
+<td>
+<code><span class="keyword">public</span> <span class="identifier">Klass</span><span class="symbol">(</span><span class="symbol">)</span></code></td>
+</tr>
+</tbody>
+</table>
+<h3>Class Object Properties</h3>
+<table>
+<tbody>
+<tr>
+<td>
+<a href="out.html">x</a></td>
+<td>
+<code><span class="keyword">val </span><span class="identifier">x</span><span class="symbol">: </span><span class="identifier">Int</span></code></td>
+</tr>
+</tbody>
+</table>
+<h3>Class Object Functions</h3>
+<table>
+<tbody>
+<tr>
+<td>
+<a href="out.html">foo</a></td>
+<td>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code></td>
+</tr>
+</tbody>
+</table>
+</BODY>
+</HTML>
diff --git a/test/data/format/classWithClassObject.md b/test/data/format/classWithClassObject.md
index 10cac365..f694a76f 100644
--- a/test/data/format/classWithClassObject.md
+++ b/test/data/format/classWithClassObject.md
@@ -14,40 +14,17 @@ class Klass
### Constructors
-|
-[&lt;init&gt;](out.md)
-
- |
-```
-public Klass()
-```
-
- |
+| [&lt;init&gt;](out.md) | `public Klass()` |
### Class Object Properties
-|
-[x](out.md)
-
- |
-```
-val x: Int
-```
-
- |
+| [x](out.md) | `val x: Int` |
### Class Object Functions
-|
-[foo](out.md)
-
- |
-```
-fun foo(): Unit
-```
+| [foo](out.md) | `fun foo(): Unit` |
- |
diff --git a/test/src/TestAPI.kt b/test/src/TestAPI.kt
index 6f4e34c2..cc09f001 100644
--- a/test/src/TestAPI.kt
+++ b/test/src/TestAPI.kt
@@ -51,13 +51,12 @@ public fun verifyModel(vararg files: String, verifier: (DocumentationModule) ->
Disposer.dispose(environment)
}
-public fun verifyOutput(path: String, outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
+public fun verifyOutput(path: String, outputExtension: String, outputGenerator: (DocumentationModule, StringBuilder) -> Unit) {
verifyModel(path) {
val output = StringBuilder()
outputGenerator(it, output)
- val trimmedOutput = output.toString().split('\n').map { it.trimTrailing() }.join("\n")
- val expectedOutput = File(path.replace(".kt", ".md")).readText()
- assertEquals(expectedOutput.trimTrailing(), trimmedOutput)
+ val expectedOutput = File(path.replace(".kt", outputExtension)).readText()
+ assertEquals(expectedOutput, output.toString())
}
}
diff --git a/test/src/format/HtmlFormatTest.kt b/test/src/format/HtmlFormatTest.kt
new file mode 100644
index 00000000..758c6e7b
--- /dev/null
+++ b/test/src/format/HtmlFormatTest.kt
@@ -0,0 +1,15 @@
+package org.jetbrains.dokka.tests
+
+import org.jetbrains.dokka.KotlinLanguageService
+import org.junit.Test
+import org.jetbrains.dokka.HtmlFormatService
+
+public class HtmlFormatTest {
+ private val htmlService = HtmlFormatService(InMemoryLocationService, KotlinLanguageService())
+
+ Test fun classWithClassObject() {
+ verifyOutput("test/data/format/classWithClassObject.kt", ".html") { model, output ->
+ htmlService.appendNodes(tempLocation, output, model.members.single().members)
+ }
+ }
+}
diff --git a/test/src/format/MarkdownFormatTest.kt b/test/src/format/MarkdownFormatTest.kt
index ea501c53..5cdfb8b5 100644
--- a/test/src/format/MarkdownFormatTest.kt
+++ b/test/src/format/MarkdownFormatTest.kt
@@ -9,13 +9,13 @@ public class MarkdownFormatTest {
private val markdownService = MarkdownFormatService(InMemoryLocationService, KotlinLanguageService())
Test fun emptyDescription() {
- verifyOutput("test/data/format/emptyDescription.kt") { model, output ->
+ verifyOutput("test/data/format/emptyDescription.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}
Test fun classWithClassObject() {
- verifyOutput("test/data/format/classWithClassObject.kt") { model, output ->
+ verifyOutput("test/data/format/classWithClassObject.kt", ".md") { model, output ->
markdownService.appendNodes(tempLocation, output, model.members.single().members)
}
}