Skip to content

Commit

Permalink
add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
KimHyeonwoo committed Jul 18, 2022
1 parent 3e25104 commit 229339e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions decode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3986,17 +3986,22 @@ func TestIssue372(t *testing.T) {
}
}

type issue384 string
type issue384 struct{}

func (t *issue384) UnmarshalJSON(b []byte) error {
return nil
}

func TestIssue384(t *testing.T) {
in := "{\"data\":{\"text\": \"" + strings.Repeat("-", 492) + "\\\"\"}}\n"
dec := json.NewDecoder(strings.NewReader(in))
var v issue384
if err := dec.Decode(&v); err != nil {
t.Errorf("unexpected error: %v", err)
testcases := []string{
"{\"data\":{\"text\": \"" + strings.Repeat("-", 492) + "\\\"\"}}\n",
"[\"" + strings.Repeat("-", 508) + "\\\"\"]",
}
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)
}
}
}

0 comments on commit 229339e

Please sign in to comment.