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

Function TestSkipArray

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

Source from the content-addressed store, hash-verified

572}
573
574func TestSkipArray(t *testing.T) {
575 testCases := []struct {
576 name string
577 json string
578 expectations func(*testing.T, int, error)
579 }{
580 {
581 name: "basic",
582 json: `"testbasic"]`,
583 expectations: func(t *testing.T, i int, err error) {
584 assert.Equal(t, len(`"testbasic"]`), i)
585 assert.Nil(t, err)
586 },
587 },
588 {
589 name: "complex escape string",
590 json: `"test \\\\\" escape"]`,
591 expectations: func(t *testing.T, i int, err error) {
592 assert.Equal(t, len(`"test \\\\\" escape"]`), i)
593 assert.Nil(t, err)
594 },
595 },
596 {
597 name: "complex escape slash",
598 json: `"test \\\\\\"]`,
599 expectations: func(t *testing.T, i int, err error) {
600 assert.Equal(t, len(`"test \\\\\\"]`), i)
601 assert.Nil(t, err)
602 },
603 },
604 {
605 json: `"test \n"]`,
606 expectations: func(t *testing.T, i int, err error) {
607 assert.Equal(t, len(`"test \n"]`), i)
608 assert.Nil(t, err)
609 },
610 },
611 }
612
613 for _, test := range testCases {
614 t.Run(test.name, func(t *testing.T) {
615 dec := NewDecoder(strings.NewReader(test.json))
616 i, err := dec.skipArray()
617 test.expectations(t, i, err)
618 })
619 }
620}
621
622func TestDecodeArrayEmpty(t *testing.T) {
623 v := new(testDecodeSlice)

Callers

nothing calls this directly

Calls 2

skipArrayMethod · 0.95
NewDecoderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…