(t *testing.T)
| 1747 | } |
| 1748 | |
| 1749 | func TestPrinterPrintExprArrowFunction(t *testing.T) { |
| 1750 | o := bytes.NewBufferString("") |
| 1751 | |
| 1752 | p := printer.NewPrinter(o) |
| 1753 | p.Print(&stmt.Expression{ |
| 1754 | Expr: &expr.ArrowFunction{ |
| 1755 | Static: true, |
| 1756 | ReturnsRef: true, |
| 1757 | Params: []node.Node{ |
| 1758 | &node.Parameter{ |
| 1759 | ByRef: true, |
| 1760 | Variadic: false, |
| 1761 | Variable: &expr.Variable{ |
| 1762 | VarName: &node.Identifier{Value: "var"}, |
| 1763 | }, |
| 1764 | }, |
| 1765 | }, |
| 1766 | ReturnType: &name.FullyQualified{ |
| 1767 | Parts: []node.Node{&name.NamePart{Value: "Foo"}}, |
| 1768 | }, |
| 1769 | Expr: &expr.Variable{ |
| 1770 | VarName: &node.Identifier{Value: "a"}, |
| 1771 | }, |
| 1772 | }, |
| 1773 | }) |
| 1774 | |
| 1775 | expected := `static fn&(&$var):\Foo=>$a;` |
| 1776 | actual := o.String() |
| 1777 | |
| 1778 | if expected != actual { |
| 1779 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 1780 | } |
| 1781 | } |
| 1782 | |
| 1783 | func TestPrinterPrintExprConstFetch(t *testing.T) { |
| 1784 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…