MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / TestBindableText

Function TestBindableText

internal/server/middleware_request_text_test.go:187–208  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

185}
186
187func TestBindableText(t *testing.T) {
188 cases := []struct {
189 in string
190 want bool
191 }{
192 {"/api/v1/workspaces/demo/items/task-5", true},
193 {"/api/v1/workspaces/demo/items/café", true},
194 {"/api/v1/workspaces/demo/items/\U0001F680", true},
195 {"/", true},
196 {"", true},
197 {"/api/v1/items/bad-\xff-x", false}, // lone 0xff
198 {"/api/v1/items/bad-\xc3(-x", false}, // truncated 2-byte sequence
199 {"/api/v1/items/\xed\xa0\x80", false}, // surrogate half
200 {"/api/v1/items/\xc0\xaf", false}, // overlong encoding
201 {"/api/v1/items/bad-\x00-x", false}, // NUL: valid UTF-8, refused by Postgres
202 }
203 for _, c := range cases {
204 if got := bindableText(c.in); got != c.want {
205 t.Errorf("bindableText(%q) = %v, want %v", c.in, got, c.want)
206 }
207 }
208}
209
210// TestValidatePathPostgresNoInternalError is the dialect half: it drives the
211// vector on the backend where the 500 occurred, against a real Postgres

Callers

nothing calls this directly

Calls 1

bindableTextFunction · 0.85

Tested by

no test coverage detected