[stdlib] Improve documentation of Char.isWhitespace and test it behaves the same in different targets
This commit is contained in:
committed by
Space Team
parent
baca742a31
commit
709076acc9
@@ -17,6 +17,8 @@ class CharTest {
|
||||
"Κκϰ", "Ππϖ", "Ρρϱ", "Σςσ", "Φφϕ", "ΩωΩ", "Ṡṡẛ",
|
||||
"Θθϑϴ", "Iiİı",
|
||||
)
|
||||
|
||||
val allCharsByCategory = (Char.MIN_VALUE..Char.MAX_VALUE).groupBy { it.category }
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -326,6 +328,17 @@ class CharTest {
|
||||
assertEquals("Cc", CharCategory.CONTROL.code)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun whitespace() {
|
||||
val allWhitespace = (Char.MIN_VALUE..Char.MAX_VALUE).filter { it.isWhitespace() }
|
||||
val expected =
|
||||
listOf(CharCategory.SPACE_SEPARATOR, CharCategory.LINE_SEPARATOR, CharCategory.PARAGRAPH_SEPARATOR)
|
||||
.flatMap { allCharsByCategory[it]!! } +
|
||||
('\u0009'..'\u000D') +
|
||||
('\u001C'..'\u001F')
|
||||
assertEquals(expected.sorted(), allWhitespace)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun lowercaseChar() {
|
||||
assertEquals('\u0000', '\u0000'.lowercaseChar())
|
||||
|
||||
Reference in New Issue
Block a user