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

Function TestEscapeUnicodeString

pkg/sql/ast/value_test.go:281–301  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

279}
280
281func TestEscapeUnicodeString(t *testing.T) {
282 tests := []struct {
283 input string
284 expected string
285 }{
286 {"hello", "hello"},
287 {"hello'world", "hello''world"},
288 {"hello\\world", "hello\\\\world"},
289 {"hello世界", "hello\\4E16\\754C"},
290 {"hello\U0001F600", "hello\\+01F600"}, // Emoji (requires >16 bits)
291 }
292
293 for _, tt := range tests {
294 t.Run(tt.input, func(t *testing.T) {
295 got := escapeUnicodeString(tt.input)
296 if got != tt.expected {
297 t.Errorf("escapeUnicodeString() = %v, want %v", got, tt.expected)
298 }
299 })
300 }
301}
302
303func TestEscapeEscapedString(t *testing.T) {
304 tests := []struct {

Callers

nothing calls this directly

Calls 3

escapeUnicodeStringFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected