You've already forked json-iterator
mirror of
https://github.com/json-iterator/go.git
synced 2025-06-15 22:50:24 +02:00
consolidate more tests
This commit is contained in:
@ -199,3 +199,28 @@ func TestDecodeErrorType(t *testing.T) {
|
||||
should.Nil(jsoniter.Unmarshal([]byte("null"), &err))
|
||||
should.NotNil(jsoniter.Unmarshal([]byte("123"), &err))
|
||||
}
|
||||
|
||||
func Test_decode_slash(t *testing.T) {
|
||||
should := require.New(t)
|
||||
var obj interface{}
|
||||
should.NotNil(json.Unmarshal([]byte("\\"), &obj))
|
||||
should.NotNil(jsoniter.UnmarshalFromString("\\", &obj))
|
||||
}
|
||||
|
||||
func Test_NilInput(t *testing.T) {
|
||||
var jb []byte // nil
|
||||
var out string
|
||||
err := jsoniter.Unmarshal(jb, &out)
|
||||
if err == nil {
|
||||
t.Errorf("Expected error")
|
||||
}
|
||||
}
|
||||
|
||||
func Test_EmptyInput(t *testing.T) {
|
||||
jb := []byte("")
|
||||
var out string
|
||||
err := jsoniter.Unmarshal(jb, &out)
|
||||
if err == nil {
|
||||
t.Errorf("Expected error")
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user