MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / TestWrite

Function TestWrite

IceFireDB-Redis-Proxy/test/proto/proto_test.go:10–28  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestWrite(t *testing.T) {
11 test := func(want string, cmd ...string) {
12 t.Helper()
13 buf := &strings.Builder{}
14 if err := Write(buf, cmd); err != nil {
15 t.Errorf("write: %s", err)
16 return
17 }
18 have := buf.String()
19 if have != want {
20 t.Errorf("have %q, want %q", have, want)
21 }
22 }
23
24 test("*0\r\n")
25 test("*1\r\n$0\r\n\r\n", "")
26 test("*1\r\n$4\r\nPING\r\n", "PING")
27 test("*3\r\n$4\r\nPING\r\n$1\r\na\r\n$1\r\nb\r\n", "PING", "a", "b")
28}
29
30// https://github.com/antirez/RESP3/blob/master/spec.md
31func TestRead(t *testing.T) {

Callers

nothing calls this directly

Calls 2

WriteFunction · 0.70
StringMethod · 0.65

Tested by

no test coverage detected