(t *testing.T, expr string)
| 64 | var hiddenTestVars = map[string]string{"a": "@a", "b": "@b"} |
| 65 | |
| 66 | func parseMutabilityExpr(t *testing.T, expr string) *ast.AST { |
| 67 | t.Helper() |
| 68 | p, err := parser.NewParser( |
| 69 | parser.Macros(append(parser.AllMacros, compreMacro, compre2Macro, bindMacro, insertMacro)...), |
| 70 | ) |
| 71 | if err != nil { |
| 72 | t.Fatalf("parser.NewParser() failed: %v", err) |
| 73 | } |
| 74 | parsed, errs := p.Parse(common.NewTextSource(expr)) |
| 75 | if len(errs.GetErrors()) != 0 { |
| 76 | t.Fatalf("Parse(%q) failed: %v", expr, errs.ToDisplayString()) |
| 77 | } |
| 78 | hideTestVars(parsed.Expr()) |
| 79 | return parsed |
| 80 | } |
| 81 | |
| 82 | // hideTestVars renames identifiers and comprehension variables listed in hiddenTestVars. |
| 83 | func hideTestVars(e ast.Expr) { |
no test coverage detected