(t *testing.T)
| 2897 | } |
| 2898 | |
| 2899 | func TestPrinterPrintStmtCatch(t *testing.T) { |
| 2900 | o := bytes.NewBufferString("") |
| 2901 | |
| 2902 | p := printer.NewPrinter(o) |
| 2903 | p.Print(&stmt.Catch{ |
| 2904 | Types: []node.Node{ |
| 2905 | &name.Name{Parts: []node.Node{&name.NamePart{Value: "Exception"}}}, |
| 2906 | &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "RuntimeException"}}}, |
| 2907 | }, |
| 2908 | Variable: &expr.Variable{ |
| 2909 | VarName: &node.Identifier{Value: "e"}, |
| 2910 | }, |
| 2911 | Stmts: []node.Node{ |
| 2912 | &stmt.Expression{Expr: &expr.Variable{ |
| 2913 | VarName: &node.Identifier{Value: "a"}, |
| 2914 | }}, |
| 2915 | }, |
| 2916 | }) |
| 2917 | |
| 2918 | expected := `catch(Exception|\RuntimeException$e){$a;}` |
| 2919 | actual := o.String() |
| 2920 | |
| 2921 | if expected != actual { |
| 2922 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 2923 | } |
| 2924 | } |
| 2925 | |
| 2926 | func TestPrinterPrintStmtClassMethod(t *testing.T) { |
| 2927 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…