MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestFormatErrorWithUnicode

Function TestFormatErrorWithUnicode

pkg/errors/formatter_test.go:498–568  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

496}
497
498func TestFormatErrorWithUnicode(t *testing.T) {
499 tests := []struct {
500 name string
501 sql string
502 location models.Location
503 contains []string
504 }{
505 {
506 name: "Chinese SQL",
507 sql: "SELECT * FROM 用户表 WHERE 姓名 = '张三'",
508 location: models.Location{Line: 1, Column: 15},
509 contains: []string{
510 "用户表",
511 "^",
512 },
513 },
514 {
515 name: "Japanese SQL",
516 sql: "SELECT * FROM テーブル WHERE 名前 = '太郎'",
517 location: models.Location{Line: 1, Column: 15},
518 contains: []string{
519 "テーブル",
520 "^",
521 },
522 },
523 {
524 name: "Arabic SQL",
525 sql: "SELECT * FROM جدول WHERE اسم = 'أحمد'",
526 location: models.Location{Line: 1, Column: 15},
527 contains: []string{
528 "جدول",
529 "^",
530 },
531 },
532 {
533 name: "Emoji in SQL",
534 sql: "SELECT * FROM users WHERE status = '✅'",
535 location: models.Location{Line: 1, Column: 37},
536 contains: []string{
537 "✅",
538 "^",
539 },
540 },
541 {
542 name: "Multi-line Unicode",
543 sql: `SELECT *
544FROM 用户表
545WHERE 年龄 > 18`,
546 location: models.Location{Line: 2, Column: 6},
547 contains: []string{
548 "用户表",
549 "^",
550 },
551 },
552 }
553
554 for _, tt := range tests {
555 t.Run(tt.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

WithContextMethod · 0.95
ErrorMethod · 0.95
RunMethod · 0.80
NewErrorFunction · 0.70
ErrorfMethod · 0.65

Tested by

no test coverage detected