| 675 | } |
| 676 | |
| 677 | func (s *testSliceArraysStrings) UnmarshalJSONArray(dec *Decoder) error { |
| 678 | var a testArrayStrings |
| 679 | assert.Equal(s.t, len(s.arrays), dec.Index(), "decoded array index must be equal to current slice len") |
| 680 | if err := dec.AddArray(&a); err != nil { |
| 681 | return err |
| 682 | } |
| 683 | assert.Equal(s.t, len(s.arrays), dec.Index(), "decoded array index must be equal to current slice len") |
| 684 | s.arrays = append(s.arrays, a) |
| 685 | return nil |
| 686 | } |
| 687 | |
| 688 | func TestIndex(t *testing.T) { |
| 689 | testCases := []struct { |