MCPcopy Create free account
hub / github.com/go-openapi/jsonpointer / TestWithNameProvider_overridesDefault

Function TestWithNameProvider_overridesDefault

options_test.go:55–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestWithNameProvider_overridesDefault(t *testing.T) {
56 t.Parallel()
57
58 stub := &stubNameProvider{mapping: map[string]string{"renamed": "Field"}}
59
60 doc := optionStruct{Field: "hello"}
61 p, err := New("/renamed")
62 require.NoError(t, err)
63
64 v, _, err := p.Get(doc, WithNameProvider(stub))
65 require.NoError(t, err)
66 assert.Equal(t, "hello", v)
67
68 stub.mu.Lock()
69 defer stub.mu.Unlock()
70 assert.Contains(t, stub.forTypes, "renamed", "custom provider must be consulted")
71}
72
73func TestWithNameProvider_setRoutesThroughProvider(t *testing.T) {
74 t.Parallel()

Callers

nothing calls this directly

Calls 3

NewFunction · 0.85
WithNameProviderFunction · 0.85
GetMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…