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

Function TestPrinterPrintFunctionCall

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

Source from the content-addressed store, hash-verified

1889}
1890
1891func TestPrinterPrintFunctionCall(t *testing.T) {
1892 o := bytes.NewBufferString("")
1893
1894 p := printer.NewPrinter(o)
1895 p.Print(&expr.FunctionCall{
1896 Function: &expr.Variable{
1897 VarName: &node.Identifier{Value: "var"},
1898 },
1899 ArgumentList: &node.ArgumentList{
1900 Arguments: []node.Node{
1901 &node.Argument{
1902 IsReference: true,
1903 Expr: &expr.Variable{
1904 VarName: &node.Identifier{Value: "a"},
1905 },
1906 },
1907 &node.Argument{
1908 Variadic: true,
1909 Expr: &expr.Variable{
1910 VarName: &node.Identifier{Value: "b"},
1911 },
1912 },
1913 &node.Argument{
1914 Expr: &expr.Variable{
1915 VarName: &node.Identifier{Value: "c"},
1916 },
1917 },
1918 },
1919 },
1920 })
1921
1922 expected := `$var(&$a,...$b,$c)`
1923 actual := o.String()
1924
1925 if expected != actual {
1926 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1927 }
1928}
1929
1930func TestPrinterPrintInclude(t *testing.T) {
1931 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…