MCPcopy
hub / github.com/buger/jsonparser / TestGetIdempotencyInputNotMutated

Function TestGetIdempotencyInputNotMutated

obligation_property_test.go:233–248  ·  view source on GitHub ↗

============================================================================= Idempotency tests ============================================================================= Verifies: SYS-REQ-087 MCDC SYS-REQ-087: get_called_on_valid_input=T, get_does_not_mutate_input=T => TRUE

(t *testing.T)

Source from the content-addressed store, hash-verified

231// Verifies: SYS-REQ-087
232// MCDC SYS-REQ-087: get_called_on_valid_input=T, get_does_not_mutate_input=T => TRUE
233func TestGetIdempotencyInputNotMutated(t *testing.T) {
234 original := `{"name":"alice","age":30,"nested":{"key":"value"}}`
235 data := []byte(original)
236 snapshot := make([]byte, len(data))
237 copy(snapshot, data)
238
239 // Call Get multiple times with different key paths
240 Get(data, "name")
241 Get(data, "age")
242 Get(data, "nested", "key")
243 Get(data, "missing")
244
245 if !bytes.Equal(data, snapshot) {
246 t.Fatalf("Get mutated input: original %q, after %q", snapshot, data)
247 }
248}
249
250// Verifies: SYS-REQ-100
251// MCDC SYS-REQ-100: set_applied_twice_with_same_args=T, set_second_call_produces_same_result=T => TRUE

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…