aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/signatures
diff options
context:
space:
mode:
authorAndrzej Ratajczak <andrzej.ratajczak98@gmail.com>2020-09-09 14:26:28 +0200
committerPaweł Marks <Kordyjan@users.noreply.github.com>2020-09-10 13:11:02 +0200
commit3792ef312ef347ef3300690e71c1cbf963a175e3 (patch)
tree8c9ece686ca772896602a8571ea54fcbd894d1bd /plugins/base/src/test/kotlin/signatures
parentd8a3e7db72109c8f439095a924bdc1da47b6ab6a (diff)
downloaddokka-3792ef312ef347ef3300690e71c1cbf963a175e3.tar.gz
dokka-3792ef312ef347ef3300690e71c1cbf963a175e3.tar.bz2
dokka-3792ef312ef347ef3300690e71c1cbf963a175e3.zip
Add tests
Diffstat (limited to 'plugins/base/src/test/kotlin/signatures')
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt30
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureUtils.kt12
2 files changed, 30 insertions, 12 deletions
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index df2c3825..f5b1bf2e 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -1,6 +1,8 @@
package signatures
+import org.jetbrains.dokka.DokkaConfiguration
import org.jetbrains.dokka.DokkaSourceSetID
+import org.jetbrains.dokka.jdk
import org.jetbrains.dokka.testApi.testRunner.AbstractCoreTest
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
@@ -450,6 +452,34 @@ class SignatureTest : AbstractCoreTest() {
}
@Test
+ fun `typealias with generic params swapped`() {
+
+ val writerPlugin = TestOutputWriterPlugin()
+
+ testInline(
+ """
+ |/src/main/kotlin/kotlinAsJavaPlugin/Test.kt
+ |package kotlinAsJavaPlugin
+ |
+ |typealias XD<B, A> = Map<A, B>
+ |
+ |class ABC {
+ | fun someFun(xd: XD<Int, String>) = 1
+ |}
+ """.trimMargin(),
+ configuration,
+ pluginOverrides = listOf(writerPlugin)
+ ) {
+ renderingStage = { _, _ ->
+ writerPlugin.writer.renderedContent("root/kotlinAsJavaPlugin/-a-b-c/some-fun.html").signature().first().match(
+ "fun ", A("someFun"), "(xd: ", A("XD"), "<", A("Int"),
+ ", ", A("String"), ">):", A("Int"), Span()
+ )
+ }
+ }
+ }
+
+ @Test
fun `generic constructor params`() {
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureUtils.kt b/plugins/base/src/test/kotlin/signatures/SignatureUtils.kt
deleted file mode 100644
index e77b8757..00000000
--- a/plugins/base/src/test/kotlin/signatures/SignatureUtils.kt
+++ /dev/null
@@ -1,12 +0,0 @@
-package signatures
-
-import org.jsoup.Jsoup
-import org.jsoup.nodes.Element
-import utils.TestOutputWriter
-
-fun TestOutputWriter.renderedContent(path: String = "root/example.html") =
- contents.getValue(path).let { Jsoup.parse(it) }.select("#content")
- .single()
-
-fun Element.signature() = select("div.symbol.monospace")
-fun Element.firstSignature() = signature().first() \ No newline at end of file