MCPcopy
hub / github.com/tidwall/gjson / TestEscapePath

Function TestEscapePath

gjson_test.go:84–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

82}
83
84func TestEscapePath(t *testing.T) {
85 json := `{
86 "test":{
87 "*":"valZ",
88 "*v":"val0",
89 "keyv*":"val1",
90 "key*v":"val2",
91 "keyv?":"val3",
92 "key?v":"val4",
93 "keyv.":"val5",
94 "key.v":"val6",
95 "keyk*":{"key?":"val7"}
96 }
97 }`
98
99 testEscapePath(t, json, "test.\\*", "valZ")
100 testEscapePath(t, json, "test.\\*v", "val0")
101 testEscapePath(t, json, "test.keyv\\*", "val1")
102 testEscapePath(t, json, "test.key\\*v", "val2")
103 testEscapePath(t, json, "test.keyv\\?", "val3")
104 testEscapePath(t, json, "test.key\\?v", "val4")
105 testEscapePath(t, json, "test.keyv\\.", "val5")
106 testEscapePath(t, json, "test.key\\.v", "val6")
107 testEscapePath(t, json, "test.keyk\\*.key\\?", "val7")
108}
109
110// this json block is poorly formed on purpose.
111var basicJSON = ` {"age":100, "name":{"here":"B\\\"R"},

Callers

nothing calls this directly

Calls 1

testEscapePathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…