MCPcopy
hub / github.com/expr-lang/expr / TestCheck_error

Function TestCheck_error

checker/checker_test.go:157–726  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

155}
156
157func TestCheck_error(t *testing.T) {
158 errorTests := []struct{ code, err string }{
159 {
160 `Foo.Bar.Not`,
161 `
162type mock.Bar has no field Not (1:9)
163 | Foo.Bar.Not
164 | ........^
165`,
166 },
167 {
168 `Noo`,
169 `
170unknown name Noo (1:1)
171 | Noo
172 | ^
173`,
174 },
175 {
176 `Foo()`, `
177mock.Foo is not callable (1:1)
178 | Foo()
179 | ^
180`,
181 },
182 {
183 `Foo['bar']`, `
184type mock.Foo has no field bar (1:4)
185 | Foo['bar']
186 | ...^
187`,
188 },
189 {
190 `Foo.Method(42)`,
191 `
192too many arguments to call Method (1:5)
193 | Foo.Method(42)
194 | ....^
195`,
196 },
197 {`Foo.Bar()`, `
198mock.Bar is not callable (1:5)
199 | Foo.Bar()
200 | ....^
201`,
202 },
203 {`Foo.Bar.Not()`, `
204type mock.Bar has no method Not (1:9)
205 | Foo.Bar.Not()
206 | ........^
207`,
208 },
209 {`ArrayOfFoo[0].Not`, `
210type mock.Foo has no field Not (1:15)
211 | ArrayOfFoo[0].Not
212 | ..............^
213`,
214 },

Callers

nothing calls this directly

Calls 8

ParseFunction · 0.92
NoErrorFunction · 0.92
NewFunction · 0.92
EqualFunction · 0.92
RunMethod · 0.80
CheckMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…