aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/translators/utils.kt
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/translators/utils.kt')
-rw-r--r--plugins/base/src/test/kotlin/translators/utils.kt16
1 files changed, 16 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/translators/utils.kt b/plugins/base/src/test/kotlin/translators/utils.kt
new file mode 100644
index 00000000..96d3035a
--- /dev/null
+++ b/plugins/base/src/test/kotlin/translators/utils.kt
@@ -0,0 +1,16 @@
+package translators
+
+import org.jetbrains.dokka.model.DModule
+import org.jetbrains.dokka.model.doc.Description
+import org.jetbrains.dokka.model.doc.Text
+
+fun DModule.documentationOf(className: String, functionName: String): String {
+ return (packages.single()
+ .classlikes.single { it.name == className }
+ .functions.single { it.name == functionName }
+ .documentation.values.singleOrNull()
+ ?.children?.singleOrNull()
+ .run { this as? Description }
+ ?.root?.children?.single() as? Text)
+ ?.body.orEmpty()
+} \ No newline at end of file