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

commonMain.com.bkahlert.kommons.test.fixtures.UnicodeTextDocumentFixture.kt Maven / Gradle / Ivy

There is a newer version: 2.8.0
Show newest version
package com.bkahlert.kommons.test.fixtures

import io.ktor.http.ContentType
import io.ktor.http.withCharset
import io.ktor.utils.io.charsets.Charsets

/**
 * A [TextResourceFixture] encompassing different line separators
 * and at least one one-, two-, three, and four-byte UTF-8 encoded character.
 *
 * ```
 * a // "LATIN SMALL LETTER A" + "NEXT LINE (NEL)"
 * 𝕓 // "MATHEMATICAL DOUBLE-STRUCK SMALL B" + "CARRIAGE RETURN" + "LINE FEED"
 * ☰ // "TRIGRAM OF HEAVEN" + "LINE FEED"
 * 👋 // "WAVING HAND SIGN" + "LINE FEED"
 * ```
 */
public val UnicodeTextDocumentFixture: TextResourceFixture = TextResourceFixture(
    "unicode.txt",
    ContentType.Text.Plain.withCharset(Charsets.UTF_8), byteArrayOf(
        0x61u.toByte(), // LATIN SMALL LETTER A
        0xC2u.toByte(), 0x85u.toByte(), // NEXT LINE (NEL)
        0xF0u.toByte(), 0x9Du.toByte(), 0x95u.toByte(), 0x93u.toByte(), // MATHEMATICAL DOUBLE-STRUCK SMALL B
        0x0Du.toByte(), // CARRIAGE RETURN
        0x0Au.toByte(), // LINE FEED
        0xE2u.toByte(), 0x98u.toByte(), 0xB0u.toByte(), // TRIGRAM FOR HEAVEN
        0x0Au.toByte(), // LINE FEED
        0xF0u.toByte(), 0x9Fu.toByte(), 0x91u.toByte(), 0x8Bu.toByte(), // WAVING HAND SIGN
        0x0Au.toByte(), // LINE FEED
    )
)




© 2015 - 2024 Weber Informatics LLC | Privacy Policy