(t *testing.T)
| 4331 | } |
| 4332 | |
| 4333 | func TestPrinterPrintTrait(t *testing.T) { |
| 4334 | o := bytes.NewBufferString("") |
| 4335 | |
| 4336 | p := printer.NewPrinter(o) |
| 4337 | p.Print(&stmt.Trait{ |
| 4338 | TraitName: &name.Name{Parts: []node.Node{&name.NamePart{Value: "Foo"}}}, |
| 4339 | Stmts: []node.Node{ |
| 4340 | &stmt.ClassMethod{ |
| 4341 | Modifiers: []node.Node{&node.Identifier{Value: "public"}}, |
| 4342 | MethodName: &node.Identifier{Value: "foo"}, |
| 4343 | Params: []node.Node{}, |
| 4344 | Stmt: &stmt.StmtList{ |
| 4345 | Stmts: []node.Node{ |
| 4346 | &stmt.Expression{Expr: &expr.Variable{ |
| 4347 | VarName: &node.Identifier{Value: "a"}, |
| 4348 | }}, |
| 4349 | }, |
| 4350 | }, |
| 4351 | }, |
| 4352 | }, |
| 4353 | }) |
| 4354 | |
| 4355 | expected := `trait Foo{public function foo(){$a;}}` |
| 4356 | actual := o.String() |
| 4357 | |
| 4358 | if expected != actual { |
| 4359 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 4360 | } |
| 4361 | } |
| 4362 | |
| 4363 | func TestPrinterPrintStmtTry(t *testing.T) { |
| 4364 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…