aboutsummaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVladPavliuk <pavliuk.vlad@gmail.com>2024-07-14 18:22:20 +0300
committerVladPavliuk <pavliuk.vlad@gmail.com>2024-07-14 18:22:20 +0300
commit3f8712edb03390c1eed4dced27f7c2707cf14ecb (patch)
treea186834d911e19418836bf2ca3f52f334c11267a /tests/core
parent79e2f63182581547dcdb7593397d1c3e280a5670 (diff)
parente7d37607ef9ce54a80d83230150874b71d628d6d (diff)
Merge branch 'master' into json-add-int-key-map-support
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/encoding/json/test_core_json.odin21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/core/encoding/json/test_core_json.odin b/tests/core/encoding/json/test_core_json.odin
index 62f474ce0..10e09df3b 100644
--- a/tests/core/encoding/json/test_core_json.odin
+++ b/tests/core/encoding/json/test_core_json.odin
@@ -372,6 +372,27 @@ utf8_string_of_multibyte_characters :: proc(t: ^testing.T) {
}
@test
+struct_with_ignore_tags :: proc(t: ^testing.T) {
+ My_Struct :: struct {
+ a: string `json:"-"`,
+ }
+
+ my_struct := My_Struct{
+ a = "test",
+ }
+
+ my_struct_marshaled, marshal_err := json.marshal(my_struct)
+ defer delete(my_struct_marshaled)
+
+ testing.expectf(t, marshal_err == nil, "Expected `json.marshal` to return nil error, got %v", marshal_err)
+
+ my_struct_json := transmute(string)my_struct_marshaled
+ expected_json := `{}`
+
+ testing.expectf(t, expected_json == my_struct_json, "Expected `json.marshal` to return %s, got %s", expected_json, my_struct_json)
+}
+
+@test
map_with_integer_keys :: proc(t: ^testing.T) {
my_map := make(map[i32]string)
defer delete_map(my_map)