All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.kotlinx.serialization.json.JsonConfigurationTest.kt Maven / Gradle / Ivy

There is a newer version: 1.7.3
Show newest version
/*
 * 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
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy