diff options
Diffstat (limited to 'plugins/base/src/test/kotlin/utils')
-rw-r--r-- | plugins/base/src/test/kotlin/utils/contentUtils.kt | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt new file mode 100644 index 00000000..4bb36553 --- /dev/null +++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt @@ -0,0 +1,56 @@ +package utils + +import matchers.content.* + +//TODO: Try to unify those functions after update to 1.4 +fun ContentMatcherBuilder<*>.signature( + name: String, + returnType: String? = null, + vararg params: Pair<String, String> +) = + platformHinted { + group { // TODO: remove it when double wrapping for signatures will be resolved + +"final fun" + link { +name } + +"(" + params.forEachIndexed { id, (n, t) -> + +"$n:" + group { link { +t } } + if (id != params.lastIndex) + +", " + } + +")" + returnType?.let { +": $it" } + } + } + +fun ContentMatcherBuilder<*>.signatureWithReceiver( + receiver: String, + name: String, + returnType: String? = null, + vararg params: Pair<String, String> +) = + platformHinted { + group { // TODO: remove it when double wrapping for signatures will be resolved + +"final fun" + group { + link { +receiver } + } + +"." + link { +name } + +"(" + params.forEach { (n, t) -> + +"$n:" + group { link { +t } } + } + +")" + returnType?.let { +": $it" } + } + } + + +fun ContentMatcherBuilder<*>.pWrapped(text: String) = + group {// TODO: remove it when double wrapping for descriptions will be resolved + group { +text } + br() + }
\ No newline at end of file |