fix: mapping optional dep not canonicaled (#2807)

This commit is contained in:
Kevin Wan
2023-01-20 23:57:49 +08:00
committed by GitHub
parent 32a59dbc27
commit c9b05ae07e
4 changed files with 146 additions and 0 deletions

View File

@@ -930,3 +930,13 @@ func TestUnmarshalJsonArray(t *testing.T) {
assert.Equal(t, "kevin", v[0].Name)
assert.Equal(t, 18, v[0].Age)
}
func TestUnmarshalJsonBytesError(t *testing.T) {
var v []struct {
Name string `json:"name"`
Age int `json:"age"`
}
assert.Error(t, UnmarshalJsonBytes([]byte((``)), &v))
assert.Error(t, UnmarshalJsonReader(strings.NewReader(``), &v))
}