1
0
mirror of https://github.com/json-iterator/go.git synced 2025-04-23 11:37:32 +02:00

fix tests

This commit is contained in:
Tao Wen 2018-02-05 23:45:42 +08:00
parent 07f99a1124
commit 002b5ae342

View File

@ -2,16 +2,16 @@ package test
import (
"bytes"
"encoding/json"
"github.com/stretchr/testify/require"
"testing"
"github.com/json-iterator/go"
)
func Test_disallowUnknownFields(t *testing.T) {
should := require.New(t)
type TestObject struct{}
var obj TestObject
decoder := json.NewDecoder(bytes.NewBufferString(`{"field1":100}`))
decoder := jsoniter.NewDecoder(bytes.NewBufferString(`{"field1":100}`))
decoder.DisallowUnknownFields()
should.Error(decoder.Decode(&obj))
}