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

Function TestSet

set_spec_test.go:23–34  ·  view source on GitHub ↗

Verifies: SYS-REQ-009 [example] STK-REQ-005:AC-1:acceptance SYS-REQ-009:malformed_input:nominal Nominal witness for SYS-REQ-009's malformed_input obligation: a well-formed Set call (valid path, valid value, parent matches the path component kind) returns a parseable mutated JSON document with nil er

(t *testing.T)

Source from the content-addressed store, hash-verified

21// MCDC SYS-REQ-009: set_creates_missing_path=F, set_path_is_provided=T, set_returns_not_found_error=F, set_returns_updated_document=T, set_target_exists=F => TRUE
22// MCDC SYS-REQ-009: set_creates_missing_path=F, set_path_is_provided=T, set_returns_not_found_error=T, set_returns_updated_document=F, set_target_exists=F => TRUE
23func TestSet(t *testing.T) {
24 runSetTests(t, "Set()", setTests,
25 func(test SetTest) (value interface{}, dataType ValueType, err error) {
26 value, err = Set([]byte(test.json), []byte(test.setData), test.path...)
27 return
28 },
29 func(test SetTest, value interface{}) (bool, interface{}) {
30 expected := []byte(test.data.(string))
31 return bytes.Equal(expected, value.([]byte)), expected
32 },
33 )
34}
35
36// Verifies: SYS-REQ-009 [boundary]
37// 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

Callers

nothing calls this directly

Calls 2

runSetTestsFunction · 0.85
SetFunction · 0.85

Tested by

no test coverage detected