MCPcopy Index your code
hub / github.com/tinylib/msgp / TestReadStringBytes

Function TestReadStringBytes

msgp/read_bytes_test.go:552–574  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

550}
551
552func TestReadStringBytes(t *testing.T) {
553 var buf bytes.Buffer
554 en := NewWriter(&buf)
555
556 tests := []string{"", "hello", "here's another string......"}
557
558 for i, v := range tests {
559 buf.Reset()
560 en.WriteString(v)
561 en.Flush()
562
563 out, left, err := ReadStringBytes(buf.Bytes())
564 if err != nil {
565 t.Errorf("test case %d: %s", i, err)
566 }
567 if len(left) != 0 {
568 t.Errorf("expected 0 bytes left; found %d", len(left))
569 }
570 if out != v {
571 t.Errorf("%q in; %q out", v, out)
572 }
573 }
574}
575
576func TestReadComplex128Bytes(t *testing.T) {
577 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 5

WriteStringMethod · 0.95
FlushMethod · 0.95
NewWriterFunction · 0.85
ReadStringBytesFunction · 0.85
ResetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…