EncodeD JSON output as UTF-8 bytes for the JSON encoder in the Playdate bindings target.

This commit is contained in:
2026-07-26 00:37:32 +02:00
parent 0d0b397ce1
commit d233cbaddb
3 changed files with 53 additions and 8 deletions
+14
View File
@@ -224,4 +224,18 @@ struct WrapperTests {
return
}
}
@Test func jsonEncoderAccumulatesOutput() {
let encoder = JSON.Encoder()
encoder.startTable()
encoder.addTableMember(name: "level")
encoder.writeInt(3)
encoder.addTableMember(name: "name")
encoder.writeString("Röck")
encoder.endTable()
// The mock emits fragments verbatim, with no separators between
// members; "Röck" exercises multi-byte UTF-8 through the byte buffer.
#expect(encoder.json == "{\"level\":3\"name\":\"Röck\"}")
}
}