(t *testing.T)
| 2170 | } |
| 2171 | |
| 2172 | func TestPrintAltFor(t *testing.T) { |
| 2173 | o := bytes.NewBufferString("") |
| 2174 | |
| 2175 | p := printer.NewPrettyPrinter(o, " ") |
| 2176 | p.Print(&stmt.Namespace{ |
| 2177 | Stmts: []node.Node{ |
| 2178 | &stmt.AltFor{ |
| 2179 | Init: []node.Node{ |
| 2180 | &expr.Variable{VarName: &node.Identifier{Value: "a"}}, |
| 2181 | }, |
| 2182 | Cond: []node.Node{ |
| 2183 | &expr.Variable{VarName: &node.Identifier{Value: "b"}}, |
| 2184 | }, |
| 2185 | Loop: []node.Node{ |
| 2186 | &expr.Variable{VarName: &node.Identifier{Value: "c"}}, |
| 2187 | }, |
| 2188 | Stmt: &stmt.StmtList{ |
| 2189 | Stmts: []node.Node{ |
| 2190 | &stmt.Expression{Expr: &expr.Variable{VarName: &node.Identifier{Value: "d"}}}, |
| 2191 | }, |
| 2192 | }, |
| 2193 | }, |
| 2194 | }, |
| 2195 | }) |
| 2196 | |
| 2197 | expected := `namespace { |
| 2198 | for ($a; $b; $c) : |
| 2199 | $d; |
| 2200 | endfor; |
| 2201 | }` |
| 2202 | actual := o.String() |
| 2203 | |
| 2204 | if expected != actual { |
| 2205 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2206 | } |
| 2207 | } |
| 2208 | |
| 2209 | func TestPrintAltForeach(t *testing.T) { |
| 2210 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…