MCPcopy
hub / github.com/jackc/pgx / TestEncodeDecode

Function TestEncodeDecode

pgproto3/copy_both_response_test.go:11–20  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestEncodeDecode(t *testing.T) {
12 srcBytes := []byte{'W', 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}
13 dstResp := pgproto3.CopyBothResponse{}
14 err := dstResp.Decode(srcBytes[5:])
15 assert.NoError(t, err, "No errors on decode")
16 dstBytes := []byte{}
17 dstBytes, err = dstResp.Encode(dstBytes)
18 require.NoError(t, err)
19 assert.EqualValues(t, srcBytes, dstBytes, "Expecting src & dest bytes to match")
20}

Callers

nothing calls this directly

Calls 2

DecodeMethod · 0.95
EncodeMethod · 0.95

Tested by

no test coverage detected