(t *testing.T)
| 3607 | } |
| 3608 | |
| 3609 | func TestPrinterPrintStmtFunction(t *testing.T) { |
| 3610 | o := bytes.NewBufferString("") |
| 3611 | |
| 3612 | p := printer.NewPrinter(o) |
| 3613 | p.Print(&stmt.Function{ |
| 3614 | ReturnsRef: true, |
| 3615 | FunctionName: &node.Identifier{Value: "foo"}, |
| 3616 | Params: []node.Node{ |
| 3617 | &node.Parameter{ |
| 3618 | ByRef: true, |
| 3619 | Variadic: false, |
| 3620 | Variable: &expr.Variable{ |
| 3621 | VarName: &node.Identifier{Value: "var"}, |
| 3622 | }, |
| 3623 | }, |
| 3624 | }, |
| 3625 | ReturnType: &name.FullyQualified{ |
| 3626 | Parts: []node.Node{&name.NamePart{Value: "Foo"}}, |
| 3627 | }, |
| 3628 | Stmts: []node.Node{ |
| 3629 | &stmt.Nop{}, |
| 3630 | }, |
| 3631 | }) |
| 3632 | |
| 3633 | expected := `function &foo(&$var):\Foo{;}` |
| 3634 | actual := o.String() |
| 3635 | |
| 3636 | if expected != actual { |
| 3637 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 3638 | } |
| 3639 | } |
| 3640 | |
| 3641 | func TestPrinterPrintStmtGlobal(t *testing.T) { |
| 3642 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…