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

Function TestSetCreatesMissingEntryInExistingArray

set_spec_test.go:29–43  ·  view source on GitHub ↗

Verifies: SYS-REQ-009 [boundary] MCDC SYS-REQ-009: set_creates_missing_path=T, set_path_is_provided=T, set_returns_not_found_error=F, set_returns_updated_document=F, set_target_exists=F => TRUE

(t *testing.T)

Source from the content-addressed store, hash-verified

27// Verifies: SYS-REQ-009 [boundary]
28// MCDC SYS-REQ-009: set_creates_missing_path=T, set_path_is_provided=T, set_returns_not_found_error=F, set_returns_updated_document=F, set_target_exists=F => TRUE
29func TestSetCreatesMissingEntryInExistingArray(t *testing.T) {
30 value, err := Set(
31 []byte(`{"top":[{"middle":[{"present":true}]}]}`),
32 []byte(`{"bottom":"value"}`),
33 "top", "[0]", "middle", "[1]",
34 )
35 if err != nil {
36 t.Fatalf("Set returned error: %v", err)
37 }
38
39 expected := `{"top":[{"middle":[{"present":true},{"bottom":"value"}]}]}`
40 if string(value) != expected {
41 t.Fatalf("Set result mismatch: expected %s, got %s", expected, string(value))
42 }
43}
44
45// Verifies: SYS-REQ-009 [fuzz]
46// MCDC SYS-REQ-009: N/A

Callers

nothing calls this directly

Calls 1

SetFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…