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

Function TestCodeMCDC_SearchKeysKeyLevelMatch

mcdc_supplement_test.go:552–563  ·  view source on GitHub ↗

Verifies: SYS-REQ-001 [boundary] Code MC/DC gap: parser.go:287 searchKeys keyLevel == level-1 Drive keyLevel == level-1 to TRUE. This happens during normal nested key lookup where the first key matches and we descend into a nested object.

(t *testing.T)

Source from the content-addressed store, hash-verified

550// Drive keyLevel == level-1 to TRUE. This happens during normal nested key
551// lookup where the first key matches and we descend into a nested object.
552func TestCodeMCDC_SearchKeysKeyLevelMatch(t *testing.T) {
553 // Two-level path: first key matches at level 1 (keyLevel becomes 1),
554 // then at level 2, keyLevel == level-1 == 1 is TRUE for the second key.
555 data := []byte(`{"a":{"b":42}}`)
556 val, _, _, err := Get(data, "a", "b")
557 if err != nil {
558 t.Fatalf("Get nested path error: %v", err)
559 }
560 if string(val) != "42" {
561 t.Fatalf("Get nested path = %q, want %q", string(val), "42")
562 }
563}
564
565// Verifies: SYS-REQ-008 [boundary]
566// Code MC/DC gap: parser.go:491 EachKey data[i] == '{'

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected