MCPcopy
hub / github.com/buger/jsonparser / TestStringEndSentinel

Function TestStringEndSentinel

deep_spec_test.go:137–155  ·  view source on GitHub ↗

Verifies: SYS-REQ-045 [boundary] stringEnd returns -1 when no closing quote found. Callers must handle.

(t *testing.T)

Source from the content-addressed store, hash-verified

135// Verifies: SYS-REQ-045 [boundary]
136// stringEnd returns -1 when no closing quote found. Callers must handle.
137func TestStringEndSentinel(t *testing.T) {
138 // No closing quote
139 idx, _ := stringEnd([]byte(`hello`))
140 if idx != -1 {
141 t.Fatalf("stringEnd(no closing quote) = %d, want -1", idx)
142 }
143
144 // Proper closing quote
145 idx2, _ := stringEnd([]byte(`hello"`))
146 if idx2 < 0 {
147 t.Fatalf("stringEnd(with closing quote) = %d, want non-negative", idx2)
148 }
149
150 // Empty input
151 idx3, _ := stringEnd([]byte(``))
152 if idx3 != -1 {
153 t.Fatalf("stringEnd(empty) = %d, want -1", idx3)
154 }
155}
156
157// Verifies: SYS-REQ-046 [boundary]
158// blockEnd returns -1 when no matching closing bracket/brace found.

Callers

nothing calls this directly

Calls 1

stringEndFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…