diff options
author | Dmitry Jemerov <yole@jetbrains.com> | 2016-04-28 17:18:51 +0200 |
---|---|---|
committer | Dmitry Jemerov <yole@jetbrains.com> | 2016-04-28 17:18:51 +0200 |
commit | 25278e2697af68788f8efdbe32b29f0ed42f33b4 (patch) | |
tree | 1409c0d3059ef2bf006a3a754aed92eec36e815e | |
parent | 1574339f6950c8662e9b480dc0c3f63403bfdfab (diff) | |
download | dokka-25278e2697af68788f8efdbe32b29f0ed42f33b4.tar.gz dokka-25278e2697af68788f8efdbe32b29f0ed42f33b4.tar.bz2 dokka-25278e2697af68788f8efdbe32b29f0ed42f33b4.zip |
add test to ensure that @receiver is rendered
-rw-r--r-- | core/src/test/kotlin/format/MarkdownFormatTest.kt | 13 | ||||
-rw-r--r-- | core/testdata/format/extensionWithDocumentedReceiver.kt | 6 | ||||
-rw-r--r-- | core/testdata/format/extensionWithDocumentedReceiver.md | 15 |
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 + + + |