(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func 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 | |
| 73 | func TestWithNameProvider_setRoutesThroughProvider(t *testing.T) { |
| 74 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…