commonTest.kotlinx.serialization.json.JsonConfigurationTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-serialization-json
Show all versions of kotlinx-serialization-json
Kotlin multiplatform serialization runtime library
/*
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
package kotlinx.serialization.json
import kotlin.test.*
class JsonConfigurationTest {
@Test
fun testPrettyPrint() {
json(true, "")
json(true, "\n")
json(true, "\r")
json(true, "\t")
json(true, " ")
json(true, " ")
json(true, " \t\r\n\t ")
assertFailsWith { json(false, " ") }
assertFailsWith { json(false, " ") }
assertFailsWith { json(true, "f") }
assertFailsWith { json(true, "\tf\n") }
}
private fun json(prettyPrint: Boolean, prettyPrintIndent: String) = Json {
this.prettyPrint = prettyPrint
this.prettyPrintIndent = prettyPrintIndent
}
}