MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestPrinterPrintExprArrowFunction

Function TestPrinterPrintExprArrowFunction

printer/printer_test.go:1749–1781  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1747}
1748
1749func 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
1783func TestPrinterPrintExprConstFetch(t *testing.T) {
1784 o := bytes.NewBufferString("")

Callers

nothing calls this directly

Calls 3

PrintMethod · 0.95
NewPrinterFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…