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

Function TestGetNoKeyPathReturnsRoot

deep_spec_test.go:996–1008  ·  view source on GitHub ↗

Verifies: SYS-REQ-018 [boundary] No key path returns root value.

(t *testing.T)

Source from the content-addressed store, hash-verified

994// Verifies: SYS-REQ-018 [boundary]
995// No key path returns root value.
996func TestGetNoKeyPathReturnsRoot(t *testing.T) {
997 data := []byte(`{"a":1}`)
998 val, dt, _, err := Get(data)
999 if err != nil {
1000 t.Fatalf("Get(no keys) error = %v", err)
1001 }
1002 if dt != Object {
1003 t.Fatalf("Get(no keys) type = %v, want Object", dt)
1004 }
1005 if string(val) != `{"a":1}` {
1006 t.Fatalf("Get(no keys) value = %q, want %q", string(val), `{"a":1}`)
1007 }
1008}
1009
1010// Verifies: SYS-REQ-019 [boundary]
1011// Empty input with key path returns KeyPathNotFoundError.

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected