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

Function TestEscapeEscapedString

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

Source from the content-addressed store, hash-verified

301}
302
303func TestEscapeEscapedString(t *testing.T) {
304 tests := []struct {
305 input string
306 expected string
307 }{
308 {"hello", "hello"},
309 {"hello'world", "hello\\'world"},
310 {"hello\\world", "hello\\\\world"},
311 {"hello\nworld", "hello\\nworld"},
312 {"hello\tworld", "hello\\tworld"},
313 {"hello\rworld", "hello\\rworld"},
314 }
315
316 for _, tt := range tests {
317 t.Run(tt.input, func(t *testing.T) {
318 got := escapeEscapedString(tt.input)
319 if got != tt.expected {
320 t.Errorf("escapeEscapedString() = %v, want %v", got, tt.expected)
321 }
322 })
323 }
324}
325
326func TestEscapeQuotedString(t *testing.T) {
327 tests := []struct {

Callers

nothing calls this directly

Calls 3

escapeEscapedStringFunction · 0.85
RunMethod · 0.80
ErrorfMethod · 0.65

Tested by

no test coverage detected