MCPcopy Index your code
hub / github.com/go-openapi/jsonpointer / TestPointableInterface

Function TestPointableInterface

pointer_test.go:247–272  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

245}
246
247func TestPointableInterface(t *testing.T) {
248 t.Parallel()
249
250 t.Run("with pointable type", func(t *testing.T) {
251 p := &pointableImpl{"hello"}
252
253 result, _, err := GetForToken(p, "some")
254 require.NoError(t, err)
255 assert.Equal(t, p.a, result)
256
257 result, _, err = GetForToken(p, "something")
258 require.Error(t, err)
259 assert.Nil(t, result)
260 })
261
262 t.Run("with pointable map", func(t *testing.T) {
263 p := pointableMap{"swapped": "hello", "a": "world"}
264 result, _, err := GetForToken(p, "swap")
265 require.NoError(t, err)
266 assert.Equal(t, p["swapped"], result)
267
268 result, _, err = GetForToken(p, "a")
269 require.NoError(t, err)
270 assert.Equal(t, p["a"], result)
271 })
272}
273
274func TestGetNode(t *testing.T) {
275 t.Parallel()

Callers

nothing calls this directly

Calls 2

GetForTokenFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…