Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
lihaoyi committed Feb 15, 2024
1 parent e8744ed commit 7a1452c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions upickle/test/src/upickle/StructTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,24 @@ object StructTests extends TestSuite {
|}""".stripMargin
val struct = upickle.default.read[Map[Double, Seq[Map[Double, Int]]]](raw)

upickle.default.write(struct, indent = 4, sortKeys = true) ==> sorted
}
test("strings") {
// Make sure that when we treat things as Strings, they are sorted
// as strings, unlike the above cases where they are treated as numbers
val raw = """{"27.5": [{"10.5": 0, "2.5": 1}], "3.5": []}"""
val sorted =
"""{
| "27.5": [
| {
| "10.5": 0,
| "2.5": 1
| }
| ],
| "3.5": []
|}""".stripMargin
val struct = upickle.default.read[Map[String, Seq[Map[String, Int]]]](raw)

upickle.default.write(struct, indent = 4, sortKeys = true) ==> sorted
}
}
Expand Down

0 comments on commit 7a1452c

Please sign in to comment.