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

Function TestReadZCString

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

Source from the content-addressed store, hash-verified

526}
527
528func TestReadZCString(t *testing.T) {
529 var buf bytes.Buffer
530 en := NewWriter(&buf)
531
532 tests := []string{"", "hello", "here's another string......"}
533
534 for i, v := range tests {
535 buf.Reset()
536 en.WriteString(v)
537 en.Flush()
538
539 out, left, err := ReadStringZC(buf.Bytes())
540 if err != nil {
541 t.Errorf("test case %d: %s", i, err)
542 }
543 if len(left) != 0 {
544 t.Errorf("expected 0 bytes left; found %d", len(left))
545 }
546 if string(out) != v {
547 t.Errorf("%q in; %q out", v, out)
548 }
549 }
550}
551
552func TestReadStringBytes(t *testing.T) {
553 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…