MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / TestGetPath

Function TestGetPath

pkg/ijson/ijson_test.go:20–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

18}
19
20func TestGetPath(t *testing.T) {
21 data := []any{"a", 2.8, true, map[string]any{"c": 1.1}}
22
23 rtn, err := GetPath(data, []any{0})
24 if err != nil {
25 t.Errorf("GetPath failed: %v", err)
26 }
27 if rtn != "a" {
28 t.Errorf("GetPath failed: %v", rtn)
29 }
30
31 rtn, err = GetPath(data, []any{50})
32 if err != nil {
33 t.Errorf("GetPath failed: %v", err)
34 }
35 if rtn != nil {
36 t.Errorf("GetPath failed: %v", rtn)
37 }
38
39 rtn, err = GetPath(data, []any{3, "c"})
40 if err != nil {
41 t.Errorf("GetPath failed: %v", err)
42 }
43 if rtn != 1.1 {
44 t.Errorf("GetPath failed: %v", rtn)
45 }
46}
47
48func makeValue() any {
49 return []any{"a", 2.8, true, map[string]any{"c": 1.1}}

Callers

nothing calls this directly

Calls 1

GetPathFunction · 0.85

Tested by

no test coverage detected