Skip to content

Commit 62c7e73

Browse files
committed
Add hash test with non-utf8 character.
1 parent cf94656 commit 62c7e73

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sql/expression/function/hash_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func TestMD5(t *testing.T) {
3737
{expression.NewLiteral("abcd", types.Text), "e2fc714c4727ee9395f324cd2e7f331f"},
3838
{expression.NewLiteral(float32(2.5), types.Float32), "8221435bcce913b5c2dc22eaf6cb6590"},
3939
{expression.NewLiteral("2.5", types.Text), "8221435bcce913b5c2dc22eaf6cb6590"},
40+
{expression.NewLiteral([]byte{0x80}, types.LongBlob), "8d39dd7eef115ea6975446ef4082951f"},
4041
{NewMD5(expression.NewLiteral(int8(10), types.Int8)), "8d8e353b98d5191d5ceea1aa3eb05d43"},
4142
}
4243

@@ -232,6 +233,11 @@ func TestSHA2(t *testing.T) {
232233
expression.NewLiteral("512", types.Text),
233234
"a4281cc49c2503bd0a0876db08ac6280583ebfcee6186c054792d877e7febe63251bfb82616504ed8ee36b146a7d5c6bfcdfcf9c27969a3874bab4544efed501",
234235
},
236+
{
237+
expression.NewLiteral([]byte{0x80}, types.Blob),
238+
expression.NewLiteral(256, types.Int64),
239+
"76be8b528d0075f7aae98d6fa57a6d3c83ae480a8469e668d7b0af968995ac71",
240+
},
235241
}
236242

237243
for _, test := range tests {

0 commit comments

Comments
 (0)