MCPcopy Create free account
hub / github.com/buger/jsonparser / TestCompilePathSet

Function TestCompilePathSet

path_compiler_test.go:149–163  ·  view source on GitHub ↗

Verifies: SYS-REQ-009 (Set) Verifies: SYS-REQ-114 (JSONPath compiled paths) reqproof:proptest:skip targeted witness/regression test; not a property-test subject

(t *testing.T)

Source from the content-addressed store, hash-verified

147// Verifies: SYS-REQ-114 (JSONPath compiled paths)
148// reqproof:proptest:skip targeted witness/regression test; not a property-test subject
149func TestCompilePathSet(t *testing.T) {
150 path, err := CompilePath("users[0].name")
151 if err != nil {
152 t.Fatalf("CompilePath returned error: %v", err)
153 }
154
155 got, err := path.Set([]byte(`{"users":[{"name":"Ada"}]}`), []byte(`"Grace"`))
156 if err != nil {
157 t.Fatalf("Set returned error: %v", err)
158 }
159 want := []byte(`{"users":[{"name":"Grace"}]}`)
160 if !bytes.Equal(got, want) {
161 t.Fatalf("Set result = %s, want %s", got, want)
162 }
163}
164
165// Verifies: SYS-REQ-114 (JSONPath compiled paths)
166// reqproof:proptest:skip targeted witness/regression test; not a property-test subject

Callers

nothing calls this directly

Calls 2

CompilePathFunction · 0.85
SetMethod · 0.45

Tested by

no test coverage detected