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

Function TestSetPath

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

Source from the content-addressed store, hash-verified

242}
243
244func TestSetPath(t *testing.T) {
245 js, err := NewJson([]byte(`{}`))
246 if err != nil {
247 t.Fatalf("err %#v", err)
248 }
249
250 js.SetPath([]string{"foo", "bar"}, "baz")
251
252 s, err := js.GetPath("foo", "bar").String()
253 if err != nil {
254 t.Fatalf("err %#v", err)
255 }
256 if s != "baz" {
257 t.Errorf("got %#v", s)
258 }
259}
260
261func TestSetPathNoPath(t *testing.T) {
262 js, err := NewJson([]byte(`{"some":"data","some_number":1.0,"some_bool":false}`))

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…