MCPcopy Index your code
hub / github.com/google/mtail / TestParseInvalidPrograms

Function TestParseInvalidPrograms

internal/runtime/compiler/parser/parser_test.go:593–612  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

591}
592
593func TestParseInvalidPrograms(t *testing.T) {
594 if *parserTestDebug {
595 mtailDebug = 3
596 }
597 for _, tc := range parserInvalidPrograms {
598 tc := tc
599 t.Run(tc.name, func(t *testing.T) {
600 p := newParser(tc.name, strings.NewReader(tc.program))
601 mtailParse(p)
602
603 testutil.ExpectNoDiff(t,
604 strings.Join(tc.errors, "\n"), // want
605 strings.TrimRight(p.errors.Error(), "\n")) // got
606 if p.errors.Error() == "no errors" && *parserTestDebug {
607 s := Sexp{}
608 t.Log("AST:\n" + s.Dump(p.root))
609 }
610 })
611 }
612}
613
614var parsePositionTests = []struct {
615 name string

Callers

nothing calls this directly

Calls 6

DumpMethod · 0.95
ExpectNoDiffFunction · 0.92
newParserFunction · 0.85
mtailParseFunction · 0.85
ErrorMethod · 0.65
RunMethod · 0.45

Tested by

no test coverage detected