Skip to content

Commit

Permalink
Add test case for #20.
Browse files Browse the repository at this point in the history
  • Loading branch information
valderman committed Feb 5, 2023
1 parent 419d564 commit d7fc10a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/test/kotlin/cc/ekblad/toml/bugs/BugRegressionTests.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package cc.ekblad.toml.parser

import cc.ekblad.toml.StringTest
import cc.ekblad.toml.model.TomlValue
import cc.ekblad.toml.serialization.from
import kotlin.test.Test
import kotlin.test.assertEquals

class BugRegressionTests : StringTest {
@Test
fun `issue 20`() {
// https://github.com/valderman/4koma/issues/20
val actual = TomlValue.from(
"""
[messages]
joinMessage = "<green>[+] %playerName%"
leaveMessage = "<red>[-] %playerName%"
chatFormat = "%displayName% : %message%"
""".trimIndent()
)
val expected = TomlValue.Map(
"messages" to TomlValue.Map(
"joinMessage" to TomlValue.String("<green>[+] %playerName%"),
"leaveMessage" to TomlValue.String("<red>[-] %playerName%"),
"chatFormat" to TomlValue.String("%displayName% : %message%"),
),
)
assertEquals(expected, actual)
}
}

0 comments on commit d7fc10a

Please sign in to comment.