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

Function TestGetStringValueRaw

deep_spec_test.go:1082–1094  ·  view source on GitHub ↗

Verifies: SYS-REQ-025 [boundary] String value returned without surrounding quotes and without unescaping.

(t *testing.T)

Source from the content-addressed store, hash-verified

1080// Verifies: SYS-REQ-025 [boundary]
1081// String value returned without surrounding quotes and without unescaping.
1082func TestGetStringValueRaw(t *testing.T) {
1083 data := []byte(`{"a":"hello world"}`)
1084 val, dt, _, err := Get(data, "a")
1085 if err != nil {
1086 t.Fatalf("Get string value error: %v", err)
1087 }
1088 if dt != String {
1089 t.Fatalf("Get string value type = %v, want String", dt)
1090 }
1091 if string(val) != "hello world" {
1092 t.Fatalf("Get string value = %q, want %q", string(val), "hello world")
1093 }
1094}
1095
1096// Verifies: SYS-REQ-026 [malformed]
1097// Malformed input outside addressed path allows best-effort result.

Callers

nothing calls this directly

Calls 1

GetFunction · 0.85

Tested by

no test coverage detected