(t *testing.T)
| 19 | } |
| 20 | |
| 21 | func TestWalk(t *testing.T) { |
| 22 | var node ast.Node |
| 23 | node = &ast.BinaryNode{ |
| 24 | Operator: "+", |
| 25 | Left: &ast.IdentifierNode{Value: "foo"}, |
| 26 | Right: &ast.IdentifierNode{Value: "bar"}, |
| 27 | } |
| 28 | |
| 29 | visitor := &visitor{} |
| 30 | ast.Walk(&node, visitor) |
| 31 | assert.Equal(t, []string{"foo", "bar"}, visitor.identifiers) |
| 32 | } |
| 33 | |
| 34 | type patcher struct{} |
| 35 |