aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/utils
diff options
context:
space:
mode:
authorIgnat Beresnev <ignat.beresnev@jetbrains.com>2022-09-02 17:44:05 +0200
committerGitHub <noreply@github.com>2022-09-02 17:44:05 +0200
commit56ff8f3f24209bc9edaece876c56bd3fde1fbf8a (patch)
tree82ec6b6d9295f09b96d37166d2423b036313d7a6 /plugins/base/src/test/kotlin/utils
parent7aae28c09fc52f67d18babb0238dc8a4d397c2ad (diff)
downloaddokka-56ff8f3f24209bc9edaece876c56bd3fde1fbf8a.tar.gz
dokka-56ff8f3f24209bc9edaece876c56bd3fde1fbf8a.tar.bz2
dokka-56ff8f3f24209bc9edaece876c56bd3fde1fbf8a.zip
Underline `@param` tag key for more consistency (#2643)
* Underline `@param` tag key for more consistency * Correct keyValue table column ratio
Diffstat (limited to 'plugins/base/src/test/kotlin/utils')
-rw-r--r--plugins/base/src/test/kotlin/utils/TestUtils.kt11
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/utils/TestUtils.kt b/plugins/base/src/test/kotlin/utils/TestUtils.kt
index e4bc4a1e..8cb126d5 100644
--- a/plugins/base/src/test/kotlin/utils/TestUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/TestUtils.kt
@@ -7,6 +7,7 @@ import org.jetbrains.dokka.model.doc.P
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertTrue
import kotlin.collections.orEmpty
+import kotlin.test.asserter
@DslMarker
annotation class TestDSL
@@ -38,6 +39,16 @@ interface AssertDSL {
assert(count() == n) { "${prefix}Expected $n, got ${count()}" }
}
+/*
+ * TODO replace with kotlin.test.assertContains after migrating to Kotlin 1.5+
+ */
+internal fun <T> assertContains(iterable: Iterable<T>, element: T, ) {
+ asserter.assertTrue(
+ { "Expected the collection to contain the element.\nCollection <$iterable>, element <$element>." },
+ iterable.contains(element)
+ )
+}
+
inline fun <reified T : Any> Any?.assertIsInstance(name: String): T =
this.let { it as? T } ?: throw AssertionError("$name should not be null")