aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/base-test-utils/src/main/kotlin/utils
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2023-08-31 20:16:01 +0200
committerGitHub <noreply@github.com>2023-08-31 20:16:01 +0200
commit02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 (patch)
tree66f6d6f089a93b863bf1144666491eca6729ad05 /plugins/base/base-test-utils/src/main/kotlin/utils
parent6a181a7a2b03ec263788d137610e86937a57d434 (diff)
downloaddokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.gz
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.tar.bz2
dokka-02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33.zip
Enable explicit API mode (#3139)
Diffstat (limited to 'plugins/base/base-test-utils/src/main/kotlin/utils')
-rw-r--r--plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt18
-rw-r--r--plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt2
2 files changed, 12 insertions, 8 deletions
diff --git a/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt b/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt
index 578bbfe7..089a94ca 100644
--- a/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt
+++ b/plugins/base/base-test-utils/src/main/kotlin/utils/TestOutputWriter.kt
@@ -8,15 +8,16 @@ import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.OutputWriter
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
+import org.jetbrains.dokka.plugability.Extension
import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
import java.util.*
-class TestOutputWriterPlugin(failOnOverwrite: Boolean = true) : DokkaPlugin() {
- val writer = TestOutputWriter(failOnOverwrite)
+public class TestOutputWriterPlugin(failOnOverwrite: Boolean = true) : DokkaPlugin() {
+ public val writer: TestOutputWriter = TestOutputWriter(failOnOverwrite)
private val dokkaBase by lazy { plugin<DokkaBase>() }
- val testWriter by extending {
+ public val testWriter: Extension<OutputWriter, *, *> by extending {
(dokkaBase.outputWriter
with writer
override dokkaBase.fileWriter)
@@ -27,10 +28,12 @@ class TestOutputWriterPlugin(failOnOverwrite: Boolean = true) : DokkaPlugin() {
PluginApiPreviewAcknowledgement
}
-class TestOutputWriter(private val failOnOverwrite: Boolean = true) : OutputWriter {
- val contents: Map<String, String> get() = _contents
-
+public class TestOutputWriter(
+ private val failOnOverwrite: Boolean = true
+) : OutputWriter {
+ public val contents: Map<String, String> get() = _contents
private val _contents = Collections.synchronizedMap(mutableMapOf<String, String>())
+
override suspend fun write(path: String, text: String, ext: String) {
val fullPath = "$path$ext"
_contents.putIfAbsent(fullPath, text)?.also {
@@ -38,6 +41,7 @@ class TestOutputWriter(private val failOnOverwrite: Boolean = true) : OutputWrit
}
}
- override suspend fun writeResources(pathFrom: String, pathTo: String) =
+ override suspend fun writeResources(pathFrom: String, pathTo: String) {
write(pathTo, "*** content of $pathFrom ***", "")
+ }
}
diff --git a/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt b/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt
index 5b2ed612..207ebb8a 100644
--- a/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt
+++ b/plugins/base/base-test-utils/src/main/kotlin/utils/assertHtmlEqualsIgnoringWhitespace.kt
@@ -12,7 +12,7 @@ import kotlin.test.assertEquals
* Parses it using JSOUP, trims whitespace at the end of the line and asserts if they are equal
* parsing is required to unify the formatting
*/
-fun assertHtmlEqualsIgnoringWhitespace(expected: String, actual: String) {
+public fun assertHtmlEqualsIgnoringWhitespace(expected: String, actual: String) {
val ignoreFormattingSettings = Document.OutputSettings().indentAmount(0).outline(true)
assertEquals(
Jsoup.parse(expected).outputSettings(ignoreFormattingSettings).outerHtml().trimSpacesAtTheEndOfLine(),