Skip to content

Commit 3a896c5

Browse files
committed
[ADDED] Kitchen sink test
1 parent ce071d6 commit 3a896c5

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

lib/src/test/kotlin/io/github/json5/kotlin/JSON5ParserTextExampleFiles.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,26 @@ class JSON5ParserTextExampleFiles {
140140
val expected = "This is a valid root-level string in JSON5"
141141
assertEquals(expected, result)
142142
}
143+
144+
@Test
145+
fun testParseKitchenSinkJson5() {
146+
val path = Paths.get("src/test/resources/kitchen-sink.json5")
147+
val json5Text = Files.readString(path)
148+
val result = JSON5Parser.parse(json5Text)
149+
150+
val expected = mapOf(
151+
"unquoted" to "and you can quote me on that",
152+
"singleQuotes" to "I can use \"double quotes\" here",
153+
"lineBreaks" to "Look, Mom! No \\n's!",
154+
"hexadecimal" to 0xDECAF.toDouble(),
155+
"leadingDecimalPoint" to 0.8675309,
156+
"andTrailing" to 8675309.0,
157+
"positiveSign" to 1.0,
158+
"trailingComma" to "in objects",
159+
"andIn" to listOf("arrays"),
160+
"backwardsCompatible" to "with JSON"
161+
)
162+
163+
assertEquals(expected, result)
164+
}
143165
}

0 commit comments

Comments
 (0)