We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package issue_test import ( "encoding/json" "testing" "github.com/bytedance/sonic" "github.com/davecgh/go-spew/spew" "github.com/stretchr/testify/require" ) type Function = func() func MockFunc() { } type Unable struct { Functions []Function } type StructWithUnable struct { Foo *Unable } func TestMarshalWrapperUnable(t *testing.T) { // Wrapper a unbale serde type tests := []interface{} { map[string]*Function{}, []Function{}, struct { Foo *Function }{}, } for _, v := range(tests) { sout, serr := sonic.Marshal(&v) jout, jerr := json.Marshal(&v) require.Equal(t, serr, jerr, v) require.Equal(t, sout, jout, v) } } func TestRule(t *testing.T) { type Test struct { data string value interface{} } tests := []Test{ Test { data: "null", value: new([]Function), }, Test { data: "[null, null]", value: new([]Function), }, Test { data: "{\"foo\": null}", value: new(struct { Foo *Function }), }, } for _, v := range(tests) { spew.Dump(v) jerr := json.Unmarshal([]byte(v.data), &v.value) require.NoError(t, jerr) serr := sonic.Unmarshal([]byte(v.data), &v.value) require.NoError(t, serr) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: