commonMain.dev.mokkery.internal.render.Indentation.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mokkery-runtime Show documentation
Show all versions of mokkery-runtime Show documentation
Mokkery is a mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.
The newest version!
package dev.mokkery.internal.render
internal fun indentationString(size: Int) = CharArray(size) { ' ' }.concatToString()
internal fun String.withIndentation(size: Int) = if (lastOrNull() == '\n') {
dropLast(1).prependIndent(indentationString(size)).plus('\n')
} else {
prependIndent(indentationString(size))
}