MCPcopy
hub / github.com/redis/go-redis / TestReader_ReadStringInto_BulkString

Function TestReader_ReadStringInto_BulkString

internal/proto/reader_test.go:197–210  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

195}
196
197func TestReader_ReadStringInto_BulkString(t *testing.T) {
198 r := proto.NewReader(bytes.NewReader([]byte("$5\r\nhello\r\n")))
199 buf := make([]byte, 16)
200 n, err := r.ReadStringInto(buf)
201 if err != nil {
202 t.Fatalf("ReadStringInto: %v", err)
203 }
204 if n != 5 {
205 t.Fatalf("n = %d, want 5", n)
206 }
207 if string(buf[:n]) != "hello" {
208 t.Fatalf("got %q, want %q", buf[:n], "hello")
209 }
210}
211
212func TestReader_ReadStringInto_Status(t *testing.T) {
213 r := proto.NewReader(bytes.NewReader([]byte("+OK\r\n")))

Callers

nothing calls this directly

Calls 2

ReadStringIntoMethod · 0.95
NewReaderFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…