Skip to content
This repository was archived by the owner on Jul 12, 2025. It is now read-only.

Commit c6ccb4b

Browse files
Mukundan Kavanur Kidambijackc
authored andcommitted
Addressing feedback
1 parent e145003 commit c6ccb4b

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

copy_both_response_test.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,11 @@ import (
88
)
99

1010
func TestEncodeDecode(t *testing.T) {
11-
src := pgproto3.CopyBothResponse{
12-
OverallFormat: byte(1), // Just to differ from defaults
13-
ColumnFormatCodes: []uint16{0, 1},
14-
}
15-
dstBytes := []byte{}
16-
dstBytes = src.Encode(dstBytes)
17-
dst := pgproto3.CopyBothResponse{}
18-
err := dst.Decode(dstBytes[5:])
11+
srcBytes := []byte{'W', 0x00, 0x00, 0x00, 0x0b, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}
12+
dstResp := pgproto3.CopyBothResponse{}
13+
err := dstResp.Decode(srcBytes[5:])
1914
assert.NoError(t, err, "No errors on decode")
20-
assert.Equal(t, dst.OverallFormat, src.OverallFormat, "OverallFormat is decoded successfully")
21-
assert.EqualValues(t, dst.ColumnFormatCodes, src.ColumnFormatCodes)
15+
dstBytes := []byte{}
16+
dstBytes = dstResp.Encode(dstBytes)
17+
assert.EqualValues(t, srcBytes, dstBytes, "Expecting src & dest bytes to match")
2218
}

0 commit comments

Comments
 (0)