| 4540 | } |
| 4541 | |
| 4542 | func TestParserExpressionSizeLimit(t *testing.T) { |
| 4543 | env := testEnv(t, ParserExpressionSizeLimit(10)) |
| 4544 | _, iss := env.Parse("'greeting'") |
| 4545 | if iss.Err() != nil { |
| 4546 | t.Errorf("Parse('greeting') failed: %v", iss.Err()) |
| 4547 | } |
| 4548 | _, iss = env.Parse("'greetings'") |
| 4549 | if !strings.Contains(iss.Err().Error(), "size exceeds limit") { |
| 4550 | t.Errorf("Parse('greetings') got unexpected error: %v", iss.Err()) |
| 4551 | } |
| 4552 | } |
| 4553 | |
| 4554 | func TestExpressionNodeLimit(t *testing.T) { |
| 4555 | tests := []struct { |