MCPcopy Create free account
hub / github.com/francoispqt/gojay / TestDecoderSliceDecoderAPI

Function TestDecoderSliceDecoderAPI

decode_array_test.go:504–513  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

502}
503
504func TestDecoderSliceDecoderAPI(t *testing.T) {
505 json := `["string","string1"]`
506 testArr := testSliceStrings{}
507 dec := NewDecoder(strings.NewReader(json))
508 err := dec.DecodeArray(&testArr)
509 assert.Nil(t, err, "Err must be nil")
510 assert.Len(t, testArr, 2, "testArr should be of len 2")
511 assert.Equal(t, "string", testArr[0], "testArr[0] should be 'string'")
512 assert.Equal(t, "string1", testArr[1], "testArr[1] should be 'string1'")
513}
514
515func TestDecoderSliceDecoderAPIError(t *testing.T) {
516 testArr := testSliceInts{}

Callers

nothing calls this directly

Calls 2

DecodeArrayMethod · 0.95
NewDecoderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…