(t *testing.T)
| 3903 | } |
| 3904 | |
| 3905 | func TestParseErrorData(t *testing.T) { |
| 3906 | for _, pratt := range []bool{false, true} { |
| 3907 | t.Run(fmt.Sprintf("enablePrattParser=%t", pratt), func(t *testing.T) { |
| 3908 | p := newTestParser(t, EnablePrattParser(pratt)) |
| 3909 | src := common.NewTextSource(`a.?b`) |
| 3910 | _, iss := p.Parse(src) |
| 3911 | if len(iss.GetErrors()) != 1 { |
| 3912 | t.Fatalf("Check() of a bad expression did produce a single error: %v", iss.ToDisplayString()) |
| 3913 | } |
| 3914 | celErr := iss.GetErrors()[0] |
| 3915 | if celErr.ExprID != 2 { |
| 3916 | t.Errorf("got exprID %v, wanted 2", celErr.ExprID) |
| 3917 | } |
| 3918 | if !strings.Contains(celErr.Message, "unsupported syntax") { |
| 3919 | t.Errorf("got message %v, wanted unsupported syntax", celErr.Message) |
| 3920 | } |
| 3921 | }) |
| 3922 | } |
| 3923 | } |
| 3924 | |
| 3925 | func newTestParser(t *testing.T, options ...Option) *Parser { |
| 3926 | t.Helper() |
nothing calls this directly
no test coverage detected