(t *testing.T)
| 2689 | } |
| 2690 | |
| 2691 | func TestPrinterPrintAltForeach(t *testing.T) { |
| 2692 | o := bytes.NewBufferString("") |
| 2693 | |
| 2694 | p := printer.NewPrinter(o) |
| 2695 | p.Print(&stmt.AltForeach{ |
| 2696 | Expr: &expr.Variable{ |
| 2697 | VarName: &node.Identifier{Value: "var"}, |
| 2698 | }, |
| 2699 | Key: &expr.Variable{ |
| 2700 | VarName: &node.Identifier{Value: "key"}, |
| 2701 | }, |
| 2702 | Variable: &expr.Reference{Variable: &expr.Variable{ |
| 2703 | VarName: &node.Identifier{Value: "val"}, |
| 2704 | }}, |
| 2705 | Stmt: &stmt.StmtList{ |
| 2706 | Stmts: []node.Node{ |
| 2707 | &stmt.Expression{Expr: &expr.Variable{ |
| 2708 | VarName: &node.Identifier{Value: "d"}, |
| 2709 | }}, |
| 2710 | }, |
| 2711 | }, |
| 2712 | }) |
| 2713 | |
| 2714 | expected := `foreach($var as $key=>&$val):$d;endforeach;` |
| 2715 | actual := o.String() |
| 2716 | |
| 2717 | if expected != actual { |
| 2718 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2719 | } |
| 2720 | } |
| 2721 | |
| 2722 | func TestPrinterPrintAltIf(t *testing.T) { |
| 2723 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…