aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/src/test/kotlin/utils
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/base/src/test/kotlin/utils')
-rw-r--r--plugins/base/src/test/kotlin/utils/contentUtils.kt154
1 files changed, 76 insertions, 78 deletions
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt
index 7e1b8bf4..c7cea1f1 100644
--- a/plugins/base/src/test/kotlin/utils/contentUtils.kt
+++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt
@@ -28,36 +28,34 @@ fun ContentMatcherBuilder<*>.bareSignature(
returnType: String? = null,
vararg params: Pair<String, ParamAttributes>
) = group { // TODO: remove it when double wrapping for signatures will be resolved
- group {
- annotations.entries.forEach {
- group {
- unwrapAnnotation(it)
- }
+ annotations.entries.forEach {
+ group {
+ unwrapAnnotation(it)
}
- +("$visibility $modifier ${keywords.joinToString("") { "$it " }} fun")
- link { +name }
- +"("
- params.forEachIndexed { id, (n, t) ->
-
- t.annotations.forEach {
- unwrapAnnotation(it)
- }
- t.keywords.forEach {
- +it
- }
+ }
+ +("$visibility $modifier ${keywords.joinToString("") { "$it " }} fun")
+ link { +name }
+ +"("
+ params.forEachIndexed { id, (n, t) ->
- +"$n:"
- group { link { +(t.type) } }
- if (id != params.lastIndex)
- +", "
+ t.annotations.forEach {
+ unwrapAnnotation(it)
}
- +")"
- if (returnType != null) {
- +(": ")
- group {
- link {
- +(returnType)
- }
+ t.keywords.forEach {
+ +it
+ }
+
+ +"$n:"
+ group { link { +(t.type) } }
+ if (id != params.lastIndex)
+ +", "
+ }
+ +")"
+ if (returnType != null) {
+ +(": ")
+ group {
+ link {
+ +(returnType)
}
}
}
@@ -87,40 +85,38 @@ fun ContentMatcherBuilder<*>.bareSignatureWithReceiver(
returnType: String? = null,
vararg params: Pair<String, ParamAttributes>
) = group { // TODO: remove it when double wrapping for signatures will be resolved
- group {
- annotations.entries.forEach {
- group {
- unwrapAnnotation(it)
- }
- }
- +("$visibility $modifier ${keywords.joinToString("") { "$it " }} fun")
+ annotations.entries.forEach {
group {
- link { +receiver }
+ unwrapAnnotation(it)
}
- +"."
- link { +name }
- +"("
- params.forEachIndexed { id, (n, t) ->
-
- t.annotations.forEach {
- unwrapAnnotation(it)
- }
- t.keywords.forEach {
- +it
- }
+ }
+ +("$visibility $modifier ${keywords.joinToString("") { "$it " }} fun")
+ group {
+ link { +receiver }
+ }
+ +"."
+ link { +name }
+ +"("
+ params.forEachIndexed { id, (n, t) ->
- +"$n:"
- group { link { +(t.type) } }
- if (id != params.lastIndex)
- +", "
+ t.annotations.forEach {
+ unwrapAnnotation(it)
}
- +")"
- if (returnType != null) {
- +(": ")
- group {
- link {
- +(returnType)
- }
+ t.keywords.forEach {
+ +it
+ }
+
+ +"$n:"
+ group { link { +(t.type) } }
+ if (id != params.lastIndex)
+ +", "
+ }
+ +")"
+ if (returnType != null) {
+ +(": ")
+ group {
+ link {
+ +(returnType)
}
}
}
@@ -148,20 +144,18 @@ fun ContentMatcherBuilder<*>.propertySignature(
link { +name }
platformHinted {
group {
- group {
- annotations.entries.forEach {
- group {
- unwrapAnnotation(it)
- }
+ annotations.entries.forEach {
+ group {
+ unwrapAnnotation(it)
}
- +("$visibility $modifier ${keywords.joinToString("") { "$it " }} $preposition")
- link { +name }
- if (type != null) {
- +(": ")
- group {
- link {
- +(type)
- }
+ }
+ +("$visibility $modifier ${keywords.joinToString("") { "$it " }} $preposition")
+ link { +name }
+ if (type != null) {
+ +(": ")
+ group {
+ link {
+ +(type)
}
}
}
@@ -184,15 +178,19 @@ fun ContentMatcherBuilder<*>.unnamedTag(tag: String, content: ContentMatcherBuil
group { content() }
}
-fun ContentMatcherBuilder<*>.unwrapAnnotation(elem: Map.Entry<String, Set<String>>) {
- +"@"
- link { +elem.key }
- +"("
- elem.value.forEach {
- +("$it = ")
- skipAllNotMatching()
+private fun ContentMatcherBuilder<*>.unwrapAnnotation(elem: Map.Entry<String, Set<String>>) {
+ group {
+ +"@"
+ link { +elem.key }
+ +"("
+ elem.value.forEach {
+ group {
+ +("$it = ")
+ skipAllNotMatching()
+ }
+ }
+ +")"
}
- +")"
}
data class ParamAttributes(