Skip to content

Commit edb0728

Browse files
committed
Add error test case
Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
1 parent 28e4bc6 commit edb0728

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/fftypes/jsonany_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,18 @@ func TestUnmarshalHugeNumber(t *testing.T) {
194194
assert.Equal(t, json.Number("123456789123456789123456789"), myObj.Key1)
195195
}
196196

197+
func TestUnmarshalHugeNumberError(t *testing.T) {
198+
199+
var h *JSONAny
200+
var myObj struct {
201+
Key1 interface{} `json:"key1"`
202+
}
203+
204+
h = JSONAnyPtr(`{"key1":1234567891invalidchars234569}`)
205+
err := h.Unmarshal(context.Background(), &myObj)
206+
assert.Error(t, err)
207+
}
208+
197209
func TestNilHash(t *testing.T) {
198210
assert.Nil(t, (*JSONAny)(nil).Hash())
199211
}

0 commit comments

Comments
 (0)