MCPcopy
hub / github.com/bitly/go-simplejson / TestPathWillOverwriteExisting

Function TestPathWillOverwriteExisting

simplejson_test.go:327–343  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

325}
326
327func TestPathWillOverwriteExisting(t *testing.T) {
328 // notice how "a" is 0.1 - but then we'll try to set at path a, foo
329 js, err := NewJson([]byte(`{"this":{"a":0.1,"b":"bb","c":"cc"}}`))
330 if err != nil {
331 t.Fatalf("err %#v", err)
332 }
333
334 js.SetPath([]string{"this", "a", "foo"}, "bar")
335
336 s, err := js.GetPath("this", "a", "foo").String()
337 if err != nil {
338 t.Fatalf("err %#v", err)
339 }
340 if s != "bar" {
341 t.Errorf("got %#v", s)
342 }
343}

Callers

nothing calls this directly

Calls 4

SetPathMethod · 0.95
GetPathMethod · 0.95
NewJsonFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…