(t *testing.T)
| 1687 | } |
| 1688 | |
| 1689 | func TestDecoderObjectDecoderAPIFuncReadCloser(t *testing.T) { |
| 1690 | readCloser := ReadCloser{ |
| 1691 | json: []byte(`{ |
| 1692 | "test": "string", |
| 1693 | "test2": "string", |
| 1694 | "test3": "string", |
| 1695 | "test4": "string", |
| 1696 | "test5": "string", |
| 1697 | }`), |
| 1698 | } |
| 1699 | m := myMap(make(map[string]string)) |
| 1700 | dec := NewDecoder(&readCloser) |
| 1701 | err := dec.DecodeObject(DecodeObjectFunc(func(dec *Decoder, k string) error { |
| 1702 | str := "" |
| 1703 | err := dec.AddString(&str) |
| 1704 | if err != nil { |
| 1705 | return err |
| 1706 | } |
| 1707 | m[k] = str |
| 1708 | return nil |
| 1709 | })) |
| 1710 | assert.Nil(t, err, "err should be nil") |
| 1711 | assert.Len(t, m, 5, "len of m should be 5") |
| 1712 | } |
| 1713 | |
| 1714 | func TestDecoderObjectDecoderInvalidJSONError(t *testing.T) { |
| 1715 | v := &TestObj{} |
nothing calls this directly
no test coverage detected
searching dependent graphs…