diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2024-07-21 00:37:11 +0200 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2024-07-21 00:37:11 +0200 |
| commit | fc5ce30f34163ce1dfa7ad8b01e60317c8d43c01 (patch) | |
| tree | 37d24832e2fa9be5d54e9c832d325035f607c3f2 /tests/core/encoding/json | |
| parent | 572b400d8ea8fff2f331fe14855b384564cf23da (diff) | |
Allow json to unmarshal empty struct.
Diffstat (limited to 'tests/core/encoding/json')
| -rw-r--r-- | tests/core/encoding/json/test_core_json.odin | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/core/encoding/json/test_core_json.odin b/tests/core/encoding/json/test_core_json.odin index 10e09df3b..42ac9ce0f 100644 --- a/tests/core/encoding/json/test_core_json.odin +++ b/tests/core/encoding/json/test_core_json.odin @@ -350,6 +350,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 := `+ + * 😃 - /` |