File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
lib/src/test/kotlin/io/github/json5/kotlin Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments