(t *testing.T)
| 2318 | } |
| 2319 | |
| 2320 | func TestMaxExpressionNodeCount(t *testing.T) { |
| 2321 | p, err := NewParser(Macros(AllMacros...), MaxExpressionNodeCount(10)) |
| 2322 | if err != nil { |
| 2323 | t.Fatal(err) |
| 2324 | } |
| 2325 | src := common.NewTextSource("a.exists(x, x.exists(y, y == 1))") |
| 2326 | _, errs := p.Parse(src) |
| 2327 | if len(errs.GetErrors()) == 0 { |
| 2328 | t.Fatalf("expected errors, got none: %s", errs.ToDisplayString()) |
| 2329 | } |
| 2330 | if !strings.Contains(errs.GetErrors()[0].Message, "expression count exceeds limit of 10 while expanding macro 'exists'") { |
| 2331 | t.Fatalf("got %q, want substring matching limit error: %s", errs.GetErrors()[0].Message, errs.GetErrors()[0].ToDisplayString(src)) |
| 2332 | } |
| 2333 | } |
| 2334 | |
| 2335 | func TestParserOptionErrors(t *testing.T) { |
| 2336 | if _, err := NewParser(Macros(AllMacros...), MaxRecursionDepth(-2)); err == nil { |
nothing calls this directly
no test coverage detected