MCPcopy
hub / github.com/pingcap/tidb / TestTableCodecInvalid

Function TestTableCodecInvalid

pkg/tablecodec/tablecodec_test.go:55–66  ·  view source on GitHub ↗

https://github.com/pingcap/tidb/issues/27687.

(t *testing.T)

Source from the content-addressed store, hash-verified

53
54// https://github.com/pingcap/tidb/issues/27687.
55func TestTableCodecInvalid(t *testing.T) {
56 tableID := int64(100)
57 buf := make([]byte, 0, 11)
58 buf = append(buf, 't')
59 buf = codec.EncodeInt(buf, tableID)
60 buf = append(buf, '_', 'r')
61 buf = codec.EncodeInt(buf, -9078412423848787968)
62 buf = append(buf, '0')
63 _, err := DecodeRowKey(buf)
64 require.NotNil(t, err)
65 require.Equal(t, "invalid encoded key", err.Error())
66}
67
68// column is a structure used for test
69type column struct {

Callers

nothing calls this directly

Calls 5

EncodeIntFunction · 0.92
DecodeRowKeyFunction · 0.85
NotNilMethod · 0.80
EqualMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected