MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / TestParseError

Function TestParseError

internal/httprule/parse_test.go:347–369  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

345}
346
347func TestParseError(t *testing.T) {
348 for _, spec := range []struct {
349 input string
350 wantError error
351 }{
352 {
353 input: "v1/{name}",
354 wantError: InvalidTemplateError{
355 tmpl: "v1/{name}",
356 msg: "no leading /",
357 },
358 },
359 } {
360 _, err := Parse(spec.input)
361 if err == nil {
362 t.Errorf("Parse(%q) unexpectedly did not fail", spec.input)
363 continue
364 }
365 if !errors.Is(err, spec.wantError) {
366 t.Errorf("Error did not match expected error: got %v wanted %v", err, spec.wantError)
367 }
368 }
369}
370
371func TestParseSegmentsWithErrors(t *testing.T) {
372 for _, spec := range []struct {

Callers

nothing calls this directly

Calls 1

ParseFunction · 0.85

Tested by

no test coverage detected