1
0
mirror of https://github.com/json-iterator/go.git synced 2025-04-20 11:28:49 +02:00
json-iterator/value_tests/marshaler_test.go
2018-02-18 21:05:42 +08:00

43 lines
746 B
Go

package test
import (
"encoding/json"
"encoding"
)
func init() {
jsonMarshaler := json.Marshaler(fakeJsonMarshaler{})
textMarshaler := encoding.TextMarshaler(fakeTextMarshaler{})
marshalCases = append(marshalCases,
fakeJsonMarshaler{},
&jsonMarshaler,
fakeTextMarshaler{},
&textMarshaler,
)
}
type fakeJsonMarshaler struct {
F2 chan []byte
}
func (q fakeJsonMarshaler) MarshalJSON() ([]byte, error) {
return []byte(`""`), nil
}
func (q *fakeJsonMarshaler) UnmarshalJSON(value []byte) error {
return nil
}
type fakeTextMarshaler struct {
F2 chan []byte
}
func (q fakeTextMarshaler) MarshalText() ([]byte, error) {
return []byte(`""`), nil
}
func (q *fakeTextMarshaler) UnmarshalText(value []byte) error {
return nil
}