aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/src/test/kotlin/format/MarkdownFormatTest.kt13
-rw-r--r--core/testdata/format/extensionWithDocumentedReceiver.kt6
-rw-r--r--core/testdata/format/extensionWithDocumentedReceiver.md15
3 files changed, 33 insertions, 1 deletions
diff --git a/core/src/test/kotlin/format/MarkdownFormatTest.kt b/core/src/test/kotlin/format/MarkdownFormatTest.kt
index ad1932b1..84bf082b 100644
--- a/core/src/test/kotlin/format/MarkdownFormatTest.kt
+++ b/core/src/test/kotlin/format/MarkdownFormatTest.kt
@@ -242,6 +242,13 @@ class MarkdownFormatTest {
verifyMarkdownNodeByName("receiverParameterTypeBound", "Foo")
}
+ @Test fun extensionWithDocumentedReceiver() {
+ verifyOutput("testdata/format/extensionWithDocumentedReceiver.kt", ".md") { model, output ->
+ val nodesWithName = model.members.single().members.single().members.filter { it.name == "fn" }
+ markdownService.appendNodes(tempLocation, output, nodesWithName)
+ }
+ }
+
@Test fun jdkLinks() {
verifyMarkdownNode("jdkLinks", withKotlinRuntime = true)
}
@@ -264,7 +271,11 @@ class MarkdownFormatTest {
private fun verifyMarkdownNodeByName(fileName: String, name: String) {
verifyOutput("testdata/format/$fileName.kt", ".md") { model, output ->
- markdownService.appendNodes(tempLocation, output, model.members.single().members.filter { it.name == name })
+ val nodesWithName = model.members.single().members.filter { it.name == name }
+ if (nodesWithName.isEmpty()) {
+ throw IllegalArgumentException("Found no nodes named $name")
+ }
+ markdownService.appendNodes(tempLocation, output, nodesWithName)
}
}
}
diff --git a/core/testdata/format/extensionWithDocumentedReceiver.kt b/core/testdata/format/extensionWithDocumentedReceiver.kt
new file mode 100644
index 00000000..37fc09d9
--- /dev/null
+++ b/core/testdata/format/extensionWithDocumentedReceiver.kt
@@ -0,0 +1,6 @@
+/**
+ * Function with receiver
+ * @receiver must be a non-empty string
+ */
+fun String.fn() {
+}
diff --git a/core/testdata/format/extensionWithDocumentedReceiver.md b/core/testdata/format/extensionWithDocumentedReceiver.md
new file mode 100644
index 00000000..6fd179c6
--- /dev/null
+++ b/core/testdata/format/extensionWithDocumentedReceiver.md
@@ -0,0 +1,15 @@
+[test](test/index) / [kotlin.String](test/kotlin.-string/index) / [fn](test/kotlin.-string/fn)
+
+
+# fn
+
+`fun String.fn(): Unit`
+
+Function with receiver
+
+
+**Receiver**
+must be a non-empty string
+
+
+