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

Function TestConfigGet

config_test.go:12–33  ·  view source on GitHub ↗

Verifies: SYS-REQ-115 (lenient Config parsing) SYS-REQ-115:nominal:nominal reqproof:proptest:skip targeted witness/regression test; not a property-test subject

(t *testing.T)

Source from the content-addressed store, hash-verified

10// SYS-REQ-115:nominal:nominal
11// reqproof:proptest:skip targeted witness/regression test; not a property-test subject
12func TestConfigGet(t *testing.T) {
13 data := []byte(`{'person':{'name':'Ada','bio':'brace } and double " quote'}}`)
14
15 value, valueType, _, err := Lenient.Get(data, "person", "name")
16 if err != nil {
17 t.Fatalf("Lenient.Get returned error: %v", err)
18 }
19 if valueType != String {
20 t.Fatalf("Lenient.Get type = %v, want String", valueType)
21 }
22 if got, want := string(value), "Ada"; got != want {
23 t.Fatalf("Lenient.Get value = %q, want %q", got, want)
24 }
25
26 bio, _, _, err := Lenient.Get(data, "person", "bio")
27 if err != nil {
28 t.Fatalf("Lenient.Get nested string containing brace returned error: %v", err)
29 }
30 if got, want := string(bio), `brace } and double " quote`; got != want {
31 t.Fatalf("Lenient.Get nested value = %q, want %q", got, want)
32 }
33}
34
35// Verifies: SYS-REQ-115 (single-quoted string decoding)
36// SYS-REQ-115:nominal:nominal

Callers

nothing calls this directly

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected