diff options
author | Paweł Marks <pmarks@virtuslab.com> | 2020-03-26 13:17:38 +0100 |
---|---|---|
committer | Paweł Marks <Kordyjan@users.noreply.github.com> | 2020-03-31 16:02:09 +0200 |
commit | 810f3c922fb4f11dc3fbdddee82d919189ed8526 (patch) | |
tree | b35f93c953e3af06e4f904412cab19445ae23b12 /plugins/base/src/test/kotlin/utils/contentUtils.kt | |
parent | 136a835671ef0cdf09c3475db1b61e15aee1be48 (diff) | |
download | dokka-810f3c922fb4f11dc3fbdddee82d919189ed8526.tar.gz dokka-810f3c922fb4f11dc3fbdddee82d919189ed8526.tar.bz2 dokka-810f3c922fb4f11dc3fbdddee82d919189ed8526.zip |
Adds simple tests for parameter rendering
Diffstat (limited to 'plugins/base/src/test/kotlin/utils/contentUtils.kt')
-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 |