aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin
diff options
context:
space:
mode:
authorvmishenev <vad-mishenev@yandex.ru>2021-08-25 17:14:31 +0300
committerGitHub <noreply@github.com>2021-08-25 16:14:31 +0200
commit4fa9524e52d8ff422bb355336e3810ab28ae135c (patch)
tree66d2bc381ffc7d5c598cee4ea9e0ba13f81b1d7b /plugins/base/src/test/kotlin
parent742f96bdf5c0b842e68dfaf43f4ab3446e87e3df (diff)
downloaddokka-4fa9524e52d8ff422bb355336e3810ab28ae135c.tar.gz
dokka-4fa9524e52d8ff422bb355336e3810ab28ae135c.tar.bz2
dokka-4fa9524e52d8ff422bb355336e3810ab28ae135c.zip
Manual highlighting webhelp (#2079)
* Add manual code highlighting * Fix test * Add kotlinAsJava highlighting * Add runtime highlighting via Prism * Add copy-button for code block * Add tests and refactor * Replace `<br>` for prism.js * Parse trivial default values Co-authored-by: Marcin Aman <marcin.aman@gmail.com>
Diffstat (limited to 'plugins/base/src/test/kotlin')
-rw-r--r--plugins/base/src/test/kotlin/content/HighlightingTest.kt79
-rw-r--r--plugins/base/src/test/kotlin/enums/EnumsTest.kt8
-rw-r--r--plugins/base/src/test/kotlin/model/FunctionsTest.kt4
-rw-r--r--plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt17
-rw-r--r--plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt33
-rw-r--r--plugins/base/src/test/kotlin/signatures/SignatureTest.kt74
-rw-r--r--plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt12
7 files changed, 176 insertions, 51 deletions
diff --git a/plugins/base/src/test/kotlin/content/HighlightingTest.kt b/plugins/base/src/test/kotlin/content/HighlightingTest.kt
new file mode 100644
index 00000000..39acd2ca
--- /dev/null
+++ b/plugins/base/src/test/kotlin/content/HighlightingTest.kt
@@ -0,0 +1,79 @@
+package content
+
+import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.model.dfs
+import org.jetbrains.dokka.pages.*
+import org.junit.jupiter.api.Test
+import kotlin.test.assertTrue
+
+class HighlightingTest : BaseAbstractTest() {
+ private val configuration = dokkaConfiguration {
+ sourceSets {
+ sourceSet {
+ sourceRoots = listOf("src/")
+ classpath = listOf(commonStdlibPath!!)
+ externalDocumentationLinks = listOf(stdlibExternalDocumentationLink)
+ }
+ }
+ }
+
+ @Test
+ fun `open suspend fun`() {
+ testInline(
+ """
+ |/src/main/kotlin/test/Test.kt
+ |package example
+ |
+ | open suspend fun simpleFun(): String = "Celebrimbor"
+ """,
+ configuration
+ ) {
+ pagesTransformationStage = { module ->
+ val symbol = (module.dfs { it.name == "simpleFun" } as MemberPageNode).content
+ .dfs { it is ContentGroup && it.dci.kind == ContentKind.Symbol }
+ val children = symbol?.children
+
+ for (it in listOf(
+ Pair(0, TokenStyle.Keyword), Pair(1, TokenStyle.Keyword), Pair(2, TokenStyle.Keyword),
+ Pair(4, TokenStyle.Punctuation), Pair(5, TokenStyle.Punctuation), Pair(6, TokenStyle.Operator)
+ ))
+ assertTrue(children?.get(it.first)?.style?.contains(it.second) == true)
+ assertTrue(children?.get(3)?.children?.first()?.style?.contains(TokenStyle.Function) == true)
+ }
+ }
+ }
+
+ @Test
+ fun `plain typealias of plain class with annotation`() {
+ testInline(
+ """
+ |/src/main/kotlin/common/Test.kt
+ |package example
+ |
+ |@MustBeDocumented
+ |@Target(AnnotationTarget.TYPEALIAS)
+ |annotation class SomeAnnotation
+ |
+ |@SomeAnnotation
+ |typealias PlainTypealias = Int
+ |
+ """.trimMargin(),
+ configuration
+ ) {
+ pagesTransformationStage = { module ->
+ val symbol = (module.dfs { it.name == "example" } as PackagePageNode).content
+ .dfs { it is ContentGroup && it.dci.kind == ContentKind.Symbol }
+ val children = symbol?.children
+
+ for (it in listOf(
+ Pair(1, TokenStyle.Keyword), Pair(3, TokenStyle.Operator)
+ ))
+ assertTrue(children?.get(it.first)?.style?.contains(it.second) == true)
+ val annotation = children?.first()?.children?.first()
+
+ assertTrue(annotation?.children?.get(0)?.style?.contains(TokenStyle.Annotation) == true)
+ assertTrue(annotation?.children?.get(1)?.children?.first()?.style?.contains(TokenStyle.Annotation) == true)
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/base/src/test/kotlin/enums/EnumsTest.kt b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
index 2535140c..59a4c6f2 100644
--- a/plugins/base/src/test/kotlin/enums/EnumsTest.kt
+++ b/plugins/base/src/test/kotlin/enums/EnumsTest.kt
@@ -1,11 +1,9 @@
package enums
import matchers.content.*
-import org.jetbrains.dokka.model.ConstructorValues
-import org.jetbrains.dokka.model.DEnum
-import org.jetbrains.dokka.model.dfs
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.base.testApi.testRunner.BaseAbstractTest
+import org.jetbrains.dokka.model.*
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Test
@@ -119,8 +117,8 @@ class EnumsTest : BaseAbstractTest() {
assertEquals(1, first.extra.allOfType<ConstructorValues>().size)
assertEquals(1, second.extra.allOfType<ConstructorValues>().size)
- assertEquals(listOf("\"e1\"", "1", "true"), first.extra.allOfType<ConstructorValues>().first().values.values.first())
- assertEquals(listOf("\"e2\"", "2", "false"), second.extra.allOfType<ConstructorValues>().first().values.values.first())
+ assertEquals(listOf(StringConstant("e1"), IntegerConstant(1), BooleanConstant(true)), first.extra.allOfType<ConstructorValues>().first().values.values.first())
+ assertEquals(listOf(StringConstant("e2"), IntegerConstant(2), BooleanConstant(false)), second.extra.allOfType<ConstructorValues>().first().values.values.first())
}
}
}
diff --git a/plugins/base/src/test/kotlin/model/FunctionsTest.kt b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
index 10ff29b4..eca5daea 100644
--- a/plugins/base/src/test/kotlin/model/FunctionsTest.kt
+++ b/plugins/base/src/test/kotlin/model/FunctionsTest.kt
@@ -344,7 +344,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
parameters.forEach { p ->
p.name equals "x"
p.type.name.assertNotNull("Parameter type: ") equals "String"
- p.extra[DefaultValue]?.value equals "\"\""
+ p.extra[DefaultValue]?.value equals StringConstant("")
}
}
}
@@ -363,7 +363,7 @@ class FunctionTest : AbstractModelTest("/src/main/kotlin/function/Test.kt", "fun
parameters.forEach { p ->
p.name equals "x"
p.type.name.assertNotNull("Parameter type: ") equals "Float"
- p.extra[DefaultValue]?.value equals "3.14f"
+ p.extra[DefaultValue]?.value equals FloatConstant(3.14f)
}
}
}
diff --git a/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt b/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt
index 3c38e68c..d65a4f6e 100644
--- a/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt
+++ b/plugins/base/src/test/kotlin/renderers/html/TextStylesTest.kt
@@ -2,14 +2,13 @@ package renderers.html
import org.jetbrains.dokka.base.renderers.html.HtmlRenderer
import org.jetbrains.dokka.pages.TextStyle
+import org.jetbrains.dokka.pages.TokenStyle
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import org.junit.jupiter.api.Test
import renderers.testPage
-import utils.B
-import utils.I
-import utils.STRIKE
-import utils.match
+import utils.*
+import kotlin.test.assertEquals
class TextStylesTest : HtmlRenderingOnlyTestBase() {
@Test
@@ -40,6 +39,16 @@ class TextStylesTest : HtmlRenderingOnlyTestBase() {
}
@Test
+ fun `should include token styles`(){
+ val page = testPage {
+ text("keyword", styles = setOf(TokenStyle.Keyword))
+ }
+ HtmlRenderer(context).render(page)
+ renderedContent.match(Span("keyword"))
+ assertEquals(renderedContent.children().last().attr("class"), "token keyword")
+ }
+
+ @Test
fun `should include multiple styles at one`(){
val page = testPage {
text(
diff --git a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
index 35d91175..e631117f 100644
--- a/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/FunctionalTypeConstructorsSignatureTest.kt
@@ -44,7 +44,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": (", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": (", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -62,7 +63,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": (", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": (", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -80,7 +82,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -98,7 +101,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": (param: ", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": (param: ", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -117,7 +121,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -135,7 +140,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": suspend (", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -153,7 +159,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": suspend ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": suspend ", A("Boolean"), ".(", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -171,7 +178,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "val ", A("nF"), ": suspend (param: ", A("Int"), ") -> ", A("String"), Span()
+ "val ", A("nF"), ": suspend (param: ", A("Int"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -202,7 +210,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
A("Boolean"),
") -> ",
A("String"),
- Span()
+ Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -227,7 +236,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-java-class/index.html").signature().last().match(
- "open val ", A("javaFunction"), ": (", A("Integer"), ") -> ", A("String"), Span()
+ "open val ", A("javaFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -252,7 +262,8 @@ class FunctionalTypeConstructorsSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-java-class/index.html").signature().last().match(
- "open val ", A("kotlinFunction"), ": (", A("Integer"), ") -> ", A("String"), Span()
+ "open val ", A("kotlinFunction"), ": (", A("Integer"), ") -> ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
diff --git a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
index a56c408b..d8b23d77 100644
--- a/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/SignatureTest.kt
@@ -36,7 +36,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
- "fun ", A("simpleFun"), "(): ", A("String"), Span()
+ "fun ", A("simpleFun"), "(): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -54,7 +55,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
- "open fun ", A("simpleFun"), "(): ", A("String"), Span()
+ "open fun ", A("simpleFun"), "(): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -72,7 +74,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
- "open suspend fun ", A("simpleFun"), "(): ", A("String"), Span()
+ "open suspend fun ", A("simpleFun"), "(): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -92,7 +95,8 @@ class SignatureTest : BaseAbstractTest() {
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
"fun ", A("simpleFun"), "(a: ", A("Int"),
", b: ", A("Boolean"), ", c: ", A("Any"),
- "): ", A("String"), Span()
+ "): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -111,7 +115,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
"fun ", A("simpleFun"), "(a: (", A("Int"),
- ") -> ", A("String"), "): ", A("String"), Span()
+ ") -> ", A("String"), "): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -130,7 +135,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
"fun <", A("T"), "> ", A("simpleFun"), "(): ",
- A("T"), Span()
+ A("T"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -149,7 +155,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
"fun <", A("T"), " : ", A("String"), "> ", A("simpleFun"),
- "(): ", A("T"), Span()
+ "(): ", A("T"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -168,7 +175,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
"inline suspend fun <", A("T"), " : ", A("String"), "> ", A("simpleFun"),
- "(a: ", A("Int"), ", b: ", A("String"), "): ", A("T"), Span()
+ "(a: ", A("Int"), ", b: ", A("String"), "): ", A("T"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -186,7 +194,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
- "fun ", A("simpleFun"), "(vararg params: ", A("Int"), ")", Span()
+ "fun ", A("simpleFun"), "(vararg params: ", A("Int"), ")", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -204,7 +213,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-simple-class/index.html").firstSignature().match(
- "class ", A("SimpleClass"), Span()
+ "class ", A("SimpleClass"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -223,7 +233,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-inheriting-class-from-generic-type/index.html").firstSignature().match(
"class ", A("InheritingClassFromGenericType"), " <", A("T"), " : ", A("Number"), ", ", A("R"), " : ", A("CharSequence"),
- "> : ", A("Comparable"), "<", A("T"), "> , ", A("Collection"), "<", A("R"), ">", Span()
+ "> : ", A("Comparable"), "<", A("T"), "> , ", A("Collection"), "<", A("R"), ">", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -241,7 +252,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-k-runnable/index.html").firstSignature().match(
- "fun interface ", A("KRunnable"), Span()
+ "fun interface ", A("KRunnable"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -273,7 +285,8 @@ class SignatureTest : BaseAbstractTest() {
Div("@", A("Marking"))
),
"fun ", A("simpleFun"),
- "(): ", A("String"), Span()
+ "(): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -307,7 +320,8 @@ class SignatureTest : BaseAbstractTest() {
Div("@set:", A("Marking"))
),
"var ", A("str"),
- ": ", A("String"), Span()
+ ": ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -347,7 +361,8 @@ class SignatureTest : BaseAbstractTest() {
Div("@", A("Marking2"), "(", Span("int = ", Span("1")), Wbr, ")")
),
"fun ", A("simpleFun"),
- "(): ", A("String"), Span()
+ "(): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -387,7 +402,8 @@ class SignatureTest : BaseAbstractTest() {
)
),
"fun ", A("simpleFun"),
- "(): ", A("String"), Span()
+ "(): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -436,7 +452,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("test/example/-foo/index.html").signature().toList()[1].match(
- "typealias ", A("Foo"), " = ", A("Bar"), Span()
+ "typealias ", A("Foo"), " = ", A("Bar"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -460,7 +477,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example.html").signature().first().match(
- "typealias ", A("PlainTypealias"), " = ", A("Int"), Span()
+ "typealias ", A("PlainTypealias"), " = ", A("Int"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -494,7 +512,8 @@ class SignatureTest : BaseAbstractTest() {
"@", A("SomeAnnotation")
)
),
- "typealias ", A("PlainTypealias"), " = ", A("Int"), Span()
+ "typealias ", A("PlainTypealias"), " = ", A("Int"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -519,7 +538,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example.html").signature().first().match(
"typealias ", A("PlainTypealias"), " = ", A("Comparable"),
- "<", A("Int"), ">", Span()
+ "<", A("Int"), ">", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -545,7 +565,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example.html").signature().first().match(
"typealias ", A("GenericTypealias"), "<", A("T"), "> = ", A("Comparable"),
- "<", A("T"), ">", Span()
+ "<", A("T"), ">", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -573,7 +594,8 @@ class SignatureTest : BaseAbstractTest() {
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()
+ ", ", A("String"), ">):", A("Int"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -618,7 +640,7 @@ class SignatureTest : BaseAbstractTest() {
arrayOf("fun ", A("GenericClass"), "(x: ", A("Int"), ")", Span()),
)
).forEach {
- it.first.match(*it.second)
+ it.first.match(*it.second, ignoreSpanWithTokenStyle = true)
}
}
}
@@ -637,7 +659,8 @@ class SignatureTest : BaseAbstractTest() {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/simple-fun.html").firstSignature().match(
"fun", A("simpleFun"), "(int: ", A("Int"), " = 1, string: ", A("String"),
- " = \"string\"): ", A("String"), Span()
+ " = \"string\"): ", A("String"), Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -655,7 +678,8 @@ class SignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/index.html").firstSignature().match(
- "const val ", A("simpleVal"), ": ", A("Int"), " = 1", Span()
+ "const val ", A("simpleVal"), ": ", A("Int"), " = 1", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
diff --git a/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt b/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt
index d988bafe..c5d49cec 100644
--- a/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt
+++ b/plugins/base/src/test/kotlin/signatures/VarianceSignatureTest.kt
@@ -38,7 +38,8 @@ class VarianceSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-generic/index.html").firstSignature().match(
- "class ", A("Generic"), "<in ", A("T"), ">", Span()
+ "class ", A("Generic"), "<in ", A("T"), ">", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -56,7 +57,8 @@ class VarianceSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-generic/index.html").firstSignature().match(
- "class ", A("Generic"), "<out ", A("T"), ">", Span()
+ "class ", A("Generic"), "<out ", A("T"), ">", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -74,7 +76,8 @@ class VarianceSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-generic/index.html").firstSignature().match(
- "class ", A("Generic"), "<", A("T"), ">", Span()
+ "class ", A("Generic"), "<", A("T"), ">", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}
@@ -92,7 +95,8 @@ class VarianceSignatureTest : BaseAbstractTest() {
) {
renderingStage = { _, _ ->
writerPlugin.writer.renderedContent("root/example/-generic/index.html").firstSignature().match(
- "class ", A("Generic"), "<out ", A("T"), ":", A("List"), "<", A("CharSequence"), ">>", Span()
+ "class ", A("Generic"), "<out ", A("T"), ":", A("List"), "<", A("CharSequence"), ">>", Span(),
+ ignoreSpanWithTokenStyle = true
)
}
}