MCPcopy Index your code
hub / github.com/CodisLabs/codis / TestDecodeInvalidRequests

Function TestDecodeInvalidRequests

pkg/proxy/redis/decoder_test.go:21–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

19}
20
21func TestDecodeInvalidRequests(t *testing.T) {
22 test := []string{
23 "*hello\r\n",
24 "*-100\r\n",
25 "*3\r\nhi",
26 "*3\r\nhi\r\n",
27 "*4\r\n$1",
28 "*4\r\n$1\r",
29 "*4\r\n$1\n",
30 "*2\r\n$3\r\nget\r\n$what?\r\nx\r\n",
31 "*4\r\n$3\r\nget\r\n$1\r\nx\r\n",
32 "*2\r\n$3\r\nget\r\n$1\r\nx",
33 "*2\r\n$3\r\nget\r\n$1\r\nx\r",
34 "*2\r\n$3\r\nget\r\n$100\r\nx\r\n",
35 "$6\r\nfoobar\r",
36 "$0\rn\r\n",
37 "$-1\n",
38 "*0",
39 "*2n$3\r\nfoo\r\n$3\r\nbar\r\n",
40 "*-\r\n",
41 "+OK\n",
42 "-Error message\r",
43 }
44 for _, s := range test {
45 _, err := DecodeFromBytes([]byte(s))
46 assert.Must(err != nil)
47 }
48}
49
50func TestDecodeSimpleRequest1(t *testing.T) {
51 _, err := DecodeFromBytes([]byte("\r\n"))

Callers

nothing calls this directly

Calls 1

DecodeFromBytesFunction · 0.85

Tested by

no test coverage detected