Skip to content

Commit 4b2cbff

Browse files
committed
Move StringUtils to the main source set
1 parent da6073c commit 4b2cbff

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/test/kotlin/de/ronny_h/aoc/extensions/StringUtils.kt renamed to src/main/kotlin/de/ronny_h/aoc/extensions/StringUtils.kt

File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package de.ronny_h.aoc.extensions
2+
3+
import io.kotest.core.spec.style.StringSpec
4+
import io.kotest.matchers.shouldBe
5+
6+
class StringUtilsTest : StringSpec({
7+
8+
"asList with a one-line String returns that String" {
9+
"line one".asList() shouldBe listOf("line one")
10+
}
11+
12+
"asList with an empty String returns a list containing an empty String" {
13+
"".asList() shouldBe listOf("")
14+
}
15+
16+
"asList converts a multiline String to a list of Strings with trimmed margin" {
17+
"""
18+
line one
19+
line two
20+
line three
21+
""".asList() shouldBe listOf("line one", "line two", "line three")
22+
}
23+
24+
"asList preserves empty lines" {
25+
"""
26+
line one
27+
28+
line two
29+
line three
30+
31+
""".asList() shouldBe listOf("line one", "", "line two", "line three", "")
32+
}
33+
34+
"asList does not trim single lines" {
35+
"""
36+
line one
37+
line two
38+
line three
39+
""".asList() shouldBe listOf("line one", "line two ", "line three")
40+
}
41+
})

0 commit comments

Comments
 (0)