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

Function TestGetObjectKeyScope

deep_spec_test.go:1023–1032  ·  view source on GitHub ↗

Verifies: SYS-REQ-020 [boundary] Object key resolved at correct scope.

(t *testing.T)

Source from the content-addressed store, hash-verified

1021// Verifies: SYS-REQ-020 [boundary]
1022// Object key resolved at correct scope.
1023func TestGetObjectKeyScope(t *testing.T) {
1024 data := []byte(`{"a":{"b":1},"b":2}`)
1025 val, _, _, err := Get(data, "a", "b")
1026 if err != nil {
1027 t.Fatalf("Get nested scope error: %v", err)
1028 }
1029 if string(val) != "1" {
1030 t.Fatalf("Get nested scope = %q, want %q", string(val), "1")
1031 }
1032}
1033
1034// Verifies: SYS-REQ-021 [boundary]
1035// Valid in-bounds array index returns correct element.

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected