* fix: #2735

* chore: make error consistent
This commit is contained in:
Kevin Wan
2023-01-01 12:21:53 +08:00
committed by GitHub
parent c7a0ec428c
commit cf6c349118
5 changed files with 64 additions and 10 deletions

View File

@@ -23,7 +23,14 @@ func TestUnmarshalWithFullNameNotStruct(t *testing.T) {
var s map[string]interface{}
content := []byte(`{"name":"xiaoming"}`)
err := UnmarshalJsonBytes(content, &s)
assert.Equal(t, errValueNotStruct, err)
assert.Equal(t, errTypeMismatch, err)
}
func TestUnmarshalValueNotSettable(t *testing.T) {
var s map[string]interface{}
content := []byte(`{"name":"xiaoming"}`)
err := UnmarshalJsonBytes(content, s)
assert.Equal(t, errValueNotSettable, err)
}
func TestUnmarshalWithoutTagName(t *testing.T) {