diff options
author | Ilya Gorbunov <ilya.gorbunov@jetbrains.com> | 2017-10-27 01:55:09 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-14 16:24:14 +0300 |
commit | a3ea8698452c132ae4a756d617775f40f036b907 (patch) | |
tree | a560b517f735070debf5eafe5b3c8ea6dd5817c0 /core | |
parent | 17ab40f3854c3fa0b65e0fb3d881a2700a0b3d3d (diff) | |
download | dokka-a3ea8698452c132ae4a756d617775f40f036b907.tar.gz dokka-a3ea8698452c132ae4a756d617775f40f036b907.tar.bz2 dokka-a3ea8698452c132ae4a756d617775f40f036b907.zip |
Support assertFalse and message in assertTrue/assertFalse
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt b/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt index 4dd0bc7f..665a687f 100644 --- a/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt +++ b/core/src/main/kotlin/Samples/KotlinWebsiteSampleProcessingService.kt @@ -35,14 +35,18 @@ open class KotlinWebsiteSampleProcessingService } } - fun convertAssertTrue(expression: KtCallExpression) { + fun convertAssertTrueFalse(expression: KtCallExpression, expectedResult: Boolean) { val (argument) = expression.valueArguments builder.apply { + expression.valueArguments.getOrNull(1)?.let { + appendln("// ${it.extractStringArgumentValue()}") + // TODO: append same amount of whitespace indentation + } append("println(\"") append(argument.text) append(" is \${") append(argument.text) - append("}\") // true") + append("}\") // $expectedResult") } } @@ -77,7 +81,8 @@ open class KotlinWebsiteSampleProcessingService override fun visitCallExpression(expression: KtCallExpression) { when (expression.calleeExpression?.text) { "assertPrints" -> convertAssertPrints(expression) - "assertTrue" -> convertAssertTrue(expression) + "assertTrue" -> convertAssertTrueFalse(expression, expectedResult = true) + "assertFalse" -> convertAssertTrueFalse(expression, expectedResult = false) "assertFails" -> convertAssertFails(expression) "assertFailsWith" -> convertAssertFailsWith(expression) else -> super.visitCallExpression(expression) |