mirror of
https://github.com/json-iterator/go.git
synced 2024-11-30 08:36:43 +02:00
19 lines
372 B
Go
19 lines
372 B
Go
package extra
|
|
|
|
import (
|
|
"github.com/json-iterator/go"
|
|
"github.com/stretchr/testify/require"
|
|
"testing"
|
|
)
|
|
|
|
func Test_private_fields(t *testing.T) {
|
|
type TestObject struct {
|
|
field1 string
|
|
}
|
|
SupportPrivateFields()
|
|
should := require.New(t)
|
|
obj := TestObject{}
|
|
should.Nil(jsoniter.UnmarshalFromString(`{"field1":"Hello"}`, &obj))
|
|
should.Equal("Hello", obj.field1)
|
|
}
|