Skip to content

Commit 85ddb06

Browse files
author
Abduqodiri Qurbonzoda
committed
Use multiline string to insert parameter value
To escape not only double quotes, but also other special symbols. Also, for some reason kotlinpoet can end line in the generated code in the middle of string, just before the escape character. Thus, the generated code becomes non-compilable.
1 parent 272bfb1 commit 85ddb06

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

plugin/main/src/kotlinx/benchmark/gradle/SuiteSourceGenerator.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ class SuiteSourceGenerator(val title: String, val module: ModuleDescriptor, val
215215

216216
val defaultParametersString = defaultParameters.entries
217217
.joinToString(prefix = "mapOf(", postfix = ")") { (key, value) ->
218-
"\"${key}\" to ${value.joinToString(prefix = "listOf(", postfix = ")") { "\"${it.value.replace("\"", "\\\"")}\"" }}"
219-
218+
"\"${key}\" to ${value.joinToString(prefix = "listOf(", postfix = ")") { "\"\"\"${it.value}\"\"\"" }}"
220219
}
221220

222221
val timeUnitClass = ClassName.bestGuess(timeUnitFQN)

0 commit comments

Comments
 (0)