(t *testing.T)
| 2652 | } |
| 2653 | |
| 2654 | func TestPrinterPrintAltFor(t *testing.T) { |
| 2655 | o := bytes.NewBufferString("") |
| 2656 | |
| 2657 | p := printer.NewPrinter(o) |
| 2658 | p.Print(&stmt.AltFor{ |
| 2659 | Init: []node.Node{ |
| 2660 | &expr.Variable{ |
| 2661 | VarName: &node.Identifier{Value: "a"}, |
| 2662 | }, |
| 2663 | }, |
| 2664 | Cond: []node.Node{ |
| 2665 | &expr.Variable{ |
| 2666 | VarName: &node.Identifier{Value: "b"}, |
| 2667 | }, |
| 2668 | }, |
| 2669 | Loop: []node.Node{ |
| 2670 | &expr.Variable{ |
| 2671 | VarName: &node.Identifier{Value: "c"}, |
| 2672 | }, |
| 2673 | }, |
| 2674 | Stmt: &stmt.StmtList{ |
| 2675 | Stmts: []node.Node{ |
| 2676 | &stmt.Expression{Expr: &expr.Variable{ |
| 2677 | VarName: &node.Identifier{Value: "d"}, |
| 2678 | }}, |
| 2679 | }, |
| 2680 | }, |
| 2681 | }) |
| 2682 | |
| 2683 | expected := `for($a;$b;$c):$d;endfor;` |
| 2684 | actual := o.String() |
| 2685 | |
| 2686 | if expected != actual { |
| 2687 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2688 | } |
| 2689 | } |
| 2690 | |
| 2691 | func TestPrinterPrintAltForeach(t *testing.T) { |
| 2692 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…