blob: 2a4dc2c1483f921ef6f55320c44678d16fb4f814 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
* 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<IllegalArgumentException> { json(false, " ") }
assertFailsWith<IllegalArgumentException> { json(false, " ") }
assertFailsWith<IllegalArgumentException> { json(true, "f") }
assertFailsWith<IllegalArgumentException> { json(true, "\tf\n") }
}
private fun json(prettyPrint: Boolean, prettyPrintIndent: String) = Json {
this.prettyPrint = prettyPrint
this.prettyPrintIndent = prettyPrintIndent
}
}
|