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

Function TestParsePathErrors

path_compiler_test.go:88–116  ·  view source on GitHub ↗

Verifies: SYS-REQ-114 (JSONPath compiled paths) reqproof:proptest:skip targeted witness/regression test; not a property-test subject SYS-REQ-114:boundary:negative SYS-REQ-114:malformed_input:negative

(t *testing.T)

Source from the content-addressed store, hash-verified

86// SYS-REQ-114:boundary:negative
87// SYS-REQ-114:malformed_input:negative
88func TestParsePathErrors(t *testing.T) {
89 tests := []struct {
90 name string
91 path string
92 }{
93 {name: "empty", path: ""},
94 {name: "root prefix only", path: "$."},
95 {name: "trailing dot", path: "person.name."},
96 {name: "leading dot", path: ".person"},
97 {name: "double dot", path: "person..name"},
98 {name: "unclosed bracket", path: "users[0"},
99 {name: "empty bracket", path: "users[]"},
100 {name: "non numeric bracket", path: "users[first]"},
101 {name: "malformed wildcard", path: "users[**]"},
102 {name: "stray closing bracket", path: "users]"},
103 {name: "unterminated quote", path: `$."my key.value`},
104 {name: "characters after quote", path: `$."my key"value`},
105 {name: "characters after bracket", path: "users[0]name"},
106 {name: "dollar without separator", path: "$person.name"},
107 }
108
109 for _, test := range tests {
110 t.Run(test.name, func(t *testing.T) {
111 if got, err := ParsePath(test.path); err == nil {
112 t.Fatalf("ParsePath(%q) = %#v, want error", test.path, got)
113 }
114 })
115 }
116}
117
118// Verifies: SYS-REQ-001 (Get)
119// Verifies: SYS-REQ-114 (JSONPath compiled paths)

Callers

nothing calls this directly

Calls 1

ParsePathFunction · 0.85

Tested by

no test coverage detected