MCPcopy
hub / github.com/google/go-jsonnet / TestParserErrors

Function TestParserErrors

internal/parser/parser_test.go:253–272  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

251}
252
253func TestParserErrors(t *testing.T) {
254 for _, s := range errorTests {
255 t.Run(s.input, func(t *testing.T) {
256 tokens, err := Lex("test", "", s.input)
257 if err != nil {
258 t.Errorf("Unexpected lex error\n input: %v\n error: %v", s.input, err)
259 return
260 }
261 _, _, err = Parse(tokens)
262 if err == nil {
263 t.Errorf("Expected parse error but got success\n input: %v", s.input)
264 return
265 }
266 if err.Error() != s.err {
267 t.Errorf("Error string not as expected\n input: %v\n expected error: %v\n actual error: %v", s.input, s.err, err.Error())
268 }
269 })
270 }
271
272}

Callers

nothing calls this directly

Calls 3

LexFunction · 0.85
ParseFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…