mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-21 13:55:19 +00:00
Merge branch 'master' into json-add-int-key-map-support
This commit is contained in:
@@ -371,6 +371,27 @@ utf8_string_of_multibyte_characters :: proc(t: ^testing.T) {
|
||||
testing.expectf(t, err == nil, "Expected `json.parse` to return nil, got %v", err)
|
||||
}
|
||||
|
||||
@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)
|
||||
|
||||
Reference in New Issue
Block a user