mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-26 00:03:54 +00:00
Allow json to unmarshal empty struct.
This commit is contained in:
@@ -349,6 +349,24 @@ unmarshal_json :: proc(t: ^testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
@test
|
||||
unmarshal_empty_struct :: proc(t: ^testing.T) {
|
||||
TestStruct :: struct {}
|
||||
test := make(map[string]TestStruct)
|
||||
input: = `{
|
||||
"test_1": {},
|
||||
"test_2": {}
|
||||
}`
|
||||
err := json.unmarshal(transmute([]u8)input, &test)
|
||||
defer {
|
||||
for k in test {
|
||||
delete(k)
|
||||
}
|
||||
delete(test)
|
||||
}
|
||||
testing.expect(t, err == nil, "Expected empty struct to unmarshal without error")
|
||||
}
|
||||
|
||||
@test
|
||||
surrogate :: proc(t: ^testing.T) {
|
||||
input := `+ + * 😃 - /`
|
||||
|
||||
Reference in New Issue
Block a user