MCPcopy Create free account
hub / github.com/bcicen/jstream / TestDecoderSimple

Function TestDecoderSimple

decoder_test.go:10–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8func mkReader(s string) *bytes.Reader { return bytes.NewReader([]byte(s)) }
9
10func TestDecoderSimple(t *testing.T) {
11 var (
12 counter int
13 mv *MetaValue
14 body = `[{"bio":"bada bing bada boom","id":1,"name":"Charles","falseVal":false}]`
15 )
16
17 decoder := NewDecoder(mkReader(body), 1)
18
19 for mv = range decoder.Stream() {
20 counter++
21 t.Logf("depth=%d offset=%d len=%d (%v)", mv.Depth, mv.Offset, mv.Length, mv.Value)
22 }
23
24 if err := decoder.Err(); err != nil {
25 t.Fatalf("decoder error: %s", err)
26 }
27}
28
29func TestDecoderNested(t *testing.T) {
30 var (

Callers

nothing calls this directly

Calls 4

StreamMethod · 0.95
ErrMethod · 0.95
NewDecoderFunction · 0.85
mkReaderFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…