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

Function TestSetStringRoundTrip

escape_test.go:460–474  ·  view source on GitHub ↗

Verifies: SYS-REQ-002 (GetString) Verifies: SYS-REQ-009 (Set) Verifies: SYS-REQ-009 (Set) reqproof:proptest:skip targeted witness/regression test; not a property-test subject

(t *testing.T)

Source from the content-addressed store, hash-verified

458// Verifies: SYS-REQ-009 (Set)
459// reqproof:proptest:skip targeted witness/regression test; not a property-test subject
460func TestSetStringRoundTrip(t *testing.T) {
461 const want = "你好 🌍"
462 data, err := SetString([]byte(`{"key":null}`), want, "key")
463 if err != nil {
464 t.Fatalf("SetString returned error: %v", err)
465 }
466
467 got, err := GetString(data, "key")
468 if err != nil {
469 t.Fatalf("GetString returned error: %v", err)
470 }
471 if got != want {
472 t.Fatalf("GetString after SetString = %q; want %q", got, want)
473 }
474}
475
476// Verifies: SYS-REQ-002 (GetString)
477// Verifies: SYS-REQ-009 (Set)

Callers

nothing calls this directly

Calls 2

SetStringFunction · 0.85
GetStringFunction · 0.85

Tested by

no test coverage detected