Introduce Common readln() and readlnOrNull() top-level functions #KT-48456
This commit is contained in:
committed by
Space
parent
14b66872b5
commit
97eb28144f
@@ -48,6 +48,20 @@ class ConsoleTest {
|
||||
testReadLine("first${linuxLineSeparator}second", listOf("first", "second"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shouldReadMultipleEmptyLines() {
|
||||
testReadLine(
|
||||
"first${linuxLineSeparator}second${linuxLineSeparator}${linuxLineSeparator}${linuxLineSeparator}",
|
||||
listOf("first", "second", "", "")
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shouldReadAloneCarriageReturn() {
|
||||
val result = readLines("\r", Charsets.UTF_8)
|
||||
assertEquals(listOf("\r"), result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shouldReadConsecutiveEmptyLines() {
|
||||
testReadLine("$linuxLineSeparator$linuxLineSeparator", listOf("", ""))
|
||||
|
||||
Reference in New Issue
Block a user