(t *testing.T)
| 110 | } |
| 111 | |
| 112 | func TestReadPacketSingleByte(t *testing.T) { |
| 113 | conn := new(mockConn) |
| 114 | mc := &mysqlConn{ |
| 115 | netConn: conn, |
| 116 | buf: newBuffer(), |
| 117 | cfg: NewConfig(), |
| 118 | } |
| 119 | |
| 120 | conn.data = []byte{0x01, 0x00, 0x00, 0x00, 0xff} |
| 121 | conn.maxReads = 1 |
| 122 | packet, err := mc.readPacket() |
| 123 | if err != nil { |
| 124 | t.Fatal(err) |
| 125 | } |
| 126 | if len(packet) != 1 { |
| 127 | t.Fatalf("unexpected packet length: expected %d, got %d", 1, len(packet)) |
| 128 | } |
| 129 | if packet[0] != 0xff { |
| 130 | t.Fatalf("unexpected packet content: expected %x, got %x", 0xff, packet[0]) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | func TestReadPacketWrongSequenceID(t *testing.T) { |
| 135 | for _, testCase := range []struct { |
nothing calls this directly
no test coverage detected