forked from mirror/go-json
add more test
This commit is contained in:
parent
3e25104a7c
commit
229339ecd5
|
@ -3986,17 +3986,22 @@ func TestIssue372(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type issue384 string
|
type issue384 struct{}
|
||||||
|
|
||||||
func (t *issue384) UnmarshalJSON(b []byte) error {
|
func (t *issue384) UnmarshalJSON(b []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestIssue384(t *testing.T) {
|
func TestIssue384(t *testing.T) {
|
||||||
in := "{\"data\":{\"text\": \"" + strings.Repeat("-", 492) + "\\\"\"}}\n"
|
testcases := []string{
|
||||||
dec := json.NewDecoder(strings.NewReader(in))
|
"{\"data\":{\"text\": \"" + strings.Repeat("-", 492) + "\\\"\"}}\n",
|
||||||
var v issue384
|
"[\"" + strings.Repeat("-", 508) + "\\\"\"]",
|
||||||
if err := dec.Decode(&v); err != nil {
|
}
|
||||||
t.Errorf("unexpected error: %v", err)
|
for _, tc := range testcases {
|
||||||
|
dec := json.NewDecoder(strings.NewReader(tc))
|
||||||
|
var v issue384
|
||||||
|
if err := dec.Decode(&v); err != nil {
|
||||||
|
t.Errorf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue