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

Function TestTokenStart

parser_test.go:2293–2310  ·  view source on GitHub ↗

Verifies: STK-REQ-001 [boundary] MCDC STK-REQ-001: N/A

(t *testing.T)

Source from the content-addressed store, hash-verified

2291// Verifies: STK-REQ-001 [boundary]
2292// MCDC STK-REQ-001: N/A
2293func TestTokenStart(t *testing.T) {
2294 cases := []struct {
2295 name string
2296 input string
2297 expected int
2298 }{
2299 {name: "comma separator", input: `{"a":1,"b":2`, expected: 6},
2300 {name: "array separator", input: `[1,2`, expected: 2},
2301 {name: "opening object", input: `{"a":1`, expected: 0},
2302 {name: "no separator", input: `value`, expected: 0},
2303 }
2304
2305 for _, tc := range cases {
2306 if got := tokenStart([]byte(tc.input)); got != tc.expected {
2307 t.Fatalf("%s: tokenStart(%q) = %d, want %d", tc.name, tc.input, got, tc.expected)
2308 }
2309 }
2310}
2311
2312var parseStringTest = []ParseTest{
2313 {

Callers

nothing calls this directly

Calls 1

tokenStartFunction · 0.85

Tested by

no test coverage detected