(t *testing.T)
| 3009 | } |
| 3010 | |
| 3011 | func TestPrinterPrintStmtClass(t *testing.T) { |
| 3012 | o := bytes.NewBufferString("") |
| 3013 | |
| 3014 | p := printer.NewPrinter(o) |
| 3015 | p.Print(&stmt.Class{ |
| 3016 | Modifiers: []node.Node{&node.Identifier{Value: "abstract"}}, |
| 3017 | ClassName: &node.Identifier{Value: "Foo"}, |
| 3018 | Extends: &stmt.ClassExtends{ |
| 3019 | ClassName: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Bar"}}}, |
| 3020 | }, |
| 3021 | Implements: &stmt.ClassImplements{ |
| 3022 | InterfaceNames: []node.Node{ |
| 3023 | &name.Name{Parts: []node.Node{&name.NamePart{Value: "Baz"}}}, |
| 3024 | &name.Name{Parts: []node.Node{&name.NamePart{Value: "Quuz"}}}, |
| 3025 | }, |
| 3026 | }, |
| 3027 | Stmts: []node.Node{ |
| 3028 | &stmt.ClassConstList{ |
| 3029 | Modifiers: []node.Node{ |
| 3030 | &node.Identifier{Value: "public"}, |
| 3031 | &node.Identifier{Value: "static"}, |
| 3032 | }, |
| 3033 | Consts: []node.Node{ |
| 3034 | &stmt.Constant{ |
| 3035 | ConstantName: &node.Identifier{Value: "FOO"}, |
| 3036 | Expr: &scalar.String{Value: "'bar'"}, |
| 3037 | }, |
| 3038 | }, |
| 3039 | }, |
| 3040 | }, |
| 3041 | }) |
| 3042 | |
| 3043 | expected := `abstract class Foo extends Bar implements Baz,Quuz{public static const FOO='bar';}` |
| 3044 | actual := o.String() |
| 3045 | |
| 3046 | if expected != actual { |
| 3047 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 3048 | } |
| 3049 | } |
| 3050 | |
| 3051 | func TestPrinterPrintStmtAnonymousClass(t *testing.T) { |
| 3052 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…