MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestFormatCopyValue

Function TestFormatCopyValue

server/conn_test.go:2321–2379  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2319 shouldMatch: true,
2320 },
2321 }
2322
2323 for _, tt := range tests {
2324 t.Run(tt.name, func(t *testing.T) {
2325 m := copyDelimiterRegex.FindStringSubmatch(tt.query)
2326 matched := len(m) > 1
2327 if matched != tt.shouldMatch {
2328 t.Errorf("delimiter match: got %v, want %v", matched, tt.shouldMatch)
2329 }
2330 if matched && m[1] != tt.delimiter {
2331 t.Errorf("delimiter: got %q, want %q", m[1], tt.delimiter)
2332 }
2333 })
2334 }
2335 })
2336}
2337
2338func TestFormatCopyValue(t *testing.T) {
2339 c := &clientConn{}
2340
2341 tests := []struct {
2342 name string
2343 input interface{}
2344 expected string
2345 }{
2346 {
2347 name: "nil value",
2348 input: nil,
2349 expected: "\\N",
2350 },
2351 {
2352 name: "string value",
2353 input: "hello",
2354 expected: "hello",
2355 },
2356 {
2357 name: "integer value",
2358 input: 42,
2359 expected: "42",
2360 },
2361 {
2362 name: "float value",
2363 input: 3.14,
2364 expected: "3.14",
2365 },
2366 {
2367 name: "boolean true",
2368 input: true,
2369 expected: "true",
2370 },
2371 {
2372 name: "boolean false",
2373 input: false,
2374 expected: "false",
2375 },
2376 {
2377 name: "empty string",
2378 input: "",

Callers

nothing calls this directly

Calls 2

formatCopyValueMethod · 0.95
RunMethod · 0.65

Tested by

no test coverage detected