(t *testing.T)
| 46 | } |
| 47 | |
| 48 | func TestSimpleLocal(t *testing.T) { |
| 49 | node := &ast.Local{ |
| 50 | Binds: ast.LocalBinds{ |
| 51 | ast.LocalBind{ |
| 52 | Variable: "x", |
| 53 | Body: &ast.LiteralNull{}, |
| 54 | }, |
| 55 | }, |
| 56 | Body: &ast.Var{Id: "x"}, |
| 57 | } |
| 58 | |
| 59 | err := analyze(node) |
| 60 | if err != nil { |
| 61 | t.Errorf("Unexpected error: %+v", err) |
| 62 | } |
| 63 | if len(node.FreeVariables()) != 0 { |
| 64 | t.Errorf("Unexpected free variables %+v in root local. Expected none.", node.FreeVariables()) |
| 65 | } |
| 66 | returned := node.Body.FreeVariables() |
| 67 | expectedVars := ast.Identifiers{"x"} |
| 68 | if !hasTheseFreeVars(returned, expectedVars) { |
| 69 | t.Errorf("Unexpected free variables %+v in local body. Expected %+v.", returned, expectedVars) |
| 70 | } |
| 71 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…