diff options
author | Kamil Doległo <kamilok1965@interia.pl> | 2020-05-18 17:14:23 +0200 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-05-19 09:56:32 +0200 |
commit | 5451627eb0cf8d95dafd23e96665e062ef023d75 (patch) | |
tree | 3406e8930239681c41dadf47f75efd8bf2fde0a2 /plugins/base/src/test/kotlin/utils/contentUtils.kt | |
parent | f15ecdd5fadae9169c8b35e0bf8a1786d57563a7 (diff) | |
download | dokka-5451627eb0cf8d95dafd23e96665e062ef023d75.tar.gz dokka-5451627eb0cf8d95dafd23e96665e062ef023d75.tar.bz2 dokka-5451627eb0cf8d95dafd23e96665e062ef023d75.zip |
Add test utils for ContentDivergent and fix the tests
Diffstat (limited to 'plugins/base/src/test/kotlin/utils/contentUtils.kt')
-rw-r--r-- | plugins/base/src/test/kotlin/utils/contentUtils.kt | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/plugins/base/src/test/kotlin/utils/contentUtils.kt b/plugins/base/src/test/kotlin/utils/contentUtils.kt index 8742e91a..c71409c3 100644 --- a/plugins/base/src/test/kotlin/utils/contentUtils.kt +++ b/plugins/base/src/test/kotlin/utils/contentUtils.kt @@ -10,20 +10,26 @@ fun ContentMatcherBuilder<*>.signature( 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" } - } + bareSignature(name, returnType, *params) + } + +fun ContentMatcherBuilder<*>.bareSignature( + name: String, + returnType: String? = null, + vararg params: Pair<String, String> +) = group { + +"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, @@ -32,21 +38,29 @@ fun ContentMatcherBuilder<*>.signatureWithReceiver( 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" } + bareSignatureWithReceiver(receiver, name, returnType, *params) + } + +fun ContentMatcherBuilder<*>.bareSignatureWithReceiver( + receiver: String, + name: String, + returnType: String? = null, + vararg params: Pair<String, String> +) = + group { + +"final fun" + group { + link { +receiver } + } + +"." + link { +name } + +"(" + params.forEach { (n, t) -> + +"$n:" + group { link { +t } } } + +")" + returnType?.let { +": $it" } } |