commonMain.com.bkahlert.kommons.test.fixtures.UnicodeTextDocumentFixture.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kommons-test Show documentation
Show all versions of kommons-test Show documentation
Kommons Test is a Kotlin Multiplatform Library to ease testing.
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
)
)