@@ -38,22 +38,22 @@ func TestCharsetValidationInsertion(t *testing.T) {
3838 })
3939
4040 t .Run ("Invalid UTF-8 insertion should fail with MySQL-compatible error" , func (t * testing.T ) {
41- // Invalid UTF-8 byte sequence: [68 111 108 116 76 97 98 174]
41+ // Invalid UTF-8 byte sequence: [68 111 108 116 76 97 98 174]
4242 // This represents "DoltLab" followed by 0xAE (latin1 ® character)
4343 invalidUTF8 := []byte {0x44 , 0x6F , 0x6C , 0x74 , 0x4C , 0x61 , 0x62 , 0xAE }
44-
44+
4545 _ , _ , err := stringType .Convert (ctx , invalidUTF8 )
4646 require .Error (t , err )
4747 require .True (t , ErrBadCharsetString .Is (err ))
48-
48+
4949 // Check error message format matches MySQL: "Incorrect string value: '\xAE' for column '' at row 1"
5050 expectedErrorSubstring := "Incorrect string value: '\\ xAE'"
5151 require .Contains (t , err .Error (), expectedErrorSubstring )
5252 })
5353
5454 t .Run ("Empty invalid UTF-8 should fail gracefully" , func (t * testing.T ) {
5555 invalidUTF8 := []byte {0xFF , 0xFE } // Invalid UTF-8 start bytes
56-
56+
5757 _ , _ , err := stringType .Convert (ctx , invalidUTF8 )
5858 require .Error (t , err )
5959 require .True (t , ErrBadCharsetString .Is (err ))
@@ -70,7 +70,7 @@ func TestCharsetValidationQuerying(t *testing.T) {
7070 // This simulates data that was already stored with invalid UTF-8
7171 // MySQL allows querying such data, even if it contains invalid bytes
7272 validUTF8 := "DoltLab®" // This is valid UTF-8
73-
73+
7474 // Test SQL() method (used during query results)
7575 result , err := stringType .SQL (ctx , nil , validUTF8 )
7676 require .NoError (t , err )
@@ -81,7 +81,7 @@ func TestCharsetValidationQuerying(t *testing.T) {
8181 // Test that the SQL() method no longer validates charset
8282 // This allows querying existing invalid data for cleanup
8383 validData := "TestData"
84-
84+
8585 result , err := stringType .SQL (ctx , nil , validData )
8686 require .NoError (t , err )
8787 require .Equal (t , validData , string (result .Raw ()))
@@ -92,7 +92,7 @@ func TestCharsetErrorMessageFormat(t *testing.T) {
9292 // Test that our error message format matches MySQL exactly
9393 // MySQL: "Incorrect string value: '\xAE' for column 'name' at row 1"
9494 // Our format: "Incorrect string value: '%v' for column '%s' at row %d"
95-
95+
9696 testCases := []struct {
9797 name string
9898 invalidByte string
@@ -129,4 +129,4 @@ func TestCharsetErrorMessageFormat(t *testing.T) {
129129 require .Equal (t , tc .expectedFormat , err .Error ())
130130 })
131131 }
132- }
132+ }
0 commit comments