(t *testing.T)
| 2774 | } |
| 2775 | |
| 2776 | func TestPrinterPrintStmtAltSwitch(t *testing.T) { |
| 2777 | o := bytes.NewBufferString("") |
| 2778 | |
| 2779 | p := printer.NewPrinter(o) |
| 2780 | p.Print(&stmt.AltSwitch{ |
| 2781 | Cond: &expr.Variable{ |
| 2782 | VarName: &node.Identifier{Value: "var"}, |
| 2783 | }, |
| 2784 | CaseList: &stmt.CaseList{ |
| 2785 | Cases: []node.Node{ |
| 2786 | &stmt.Case{ |
| 2787 | Cond: &scalar.String{Value: "'a'"}, |
| 2788 | Stmts: []node.Node{ |
| 2789 | &stmt.Expression{Expr: &expr.Variable{ |
| 2790 | VarName: &node.Identifier{Value: "a"}, |
| 2791 | }}, |
| 2792 | }, |
| 2793 | }, |
| 2794 | &stmt.Case{ |
| 2795 | Cond: &scalar.String{Value: "'b'"}, |
| 2796 | Stmts: []node.Node{ |
| 2797 | &stmt.Expression{Expr: &expr.Variable{ |
| 2798 | VarName: &node.Identifier{Value: "b"}, |
| 2799 | }}, |
| 2800 | }, |
| 2801 | }, |
| 2802 | }, |
| 2803 | }, |
| 2804 | }) |
| 2805 | |
| 2806 | expected := `switch($var):case 'a':$a;case 'b':$b;endswitch;` |
| 2807 | actual := o.String() |
| 2808 | |
| 2809 | if expected != actual { |
| 2810 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2811 | } |
| 2812 | } |
| 2813 | |
| 2814 | func TestPrinterPrintAltWhile(t *testing.T) { |
| 2815 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…