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

Function TestWriteParameterStatus

server/protocol_test.go:275–298  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

273}
274
275func TestWriteParameterStatus(t *testing.T) {
276 var buf bytes.Buffer
277
278 err := wire.WriteParameterStatus(&buf, "server_version", "15.0")
279 if err != nil {
280 t.Fatalf("wire.WriteParameterStatus() error = %v", err)
281 }
282
283 // Message type should be 'S'
284 if buf.Bytes()[0] != 'S' {
285 t.Errorf("message type = %c, want S", buf.Bytes()[0])
286 }
287
288 // Check data contains null-terminated name and value
289 data := buf.Bytes()[5:]
290 parts := bytes.Split(data, []byte{0})
291
292 if string(parts[0]) != "server_version" {
293 t.Errorf("name = %q, want %q", string(parts[0]), "server_version")
294 }
295 if string(parts[1]) != "15.0" {
296 t.Errorf("value = %q, want %q", string(parts[1]), "15.0")
297 }
298}
299
300func TestWriteBackendKeyData(t *testing.T) {
301 var buf bytes.Buffer

Callers

nothing calls this directly

Calls 1

WriteParameterStatusFunction · 0.92

Tested by

no test coverage detected