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

Function TestClickHouseMacros_SplitByChar

server/chsql_test.go:70–87  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

68}
69
70func TestClickHouseMacros_SplitByChar(t *testing.T) {
71 db, err := sql.Open("duckdb", ":memory:")
72 if err != nil {
73 t.Fatalf("Failed to open database: %v", err)
74 }
75 defer func() { _ = db.Close() }()
76
77 chsql.InitMacros(db)
78
79 // splitByChar returns a list; verify via array_length
80 var got int
81 if err := db.QueryRow("SELECT array_length(splitByChar(',', 'a,b,c'))").Scan(&got); err != nil {
82 t.Fatalf("splitByChar query failed: %v", err)
83 }
84 if got != 3 {
85 t.Errorf("splitByChar(',' , 'a,b,c') length = %d, want 3", got)
86 }
87}
88
89func TestClickHouseMacros_GenerateUUIDv4(t *testing.T) {
90 db, err := sql.Open("duckdb", ":memory:")

Callers

nothing calls this directly

Calls 4

InitMacrosFunction · 0.92
CloseMethod · 0.65
ScanMethod · 0.65
OpenMethod · 0.45

Tested by

no test coverage detected