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

Function TestPrintFunctionCall

printer/pretty_printer_test.go:1521–1550  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1519}
1520
1521func TestPrintFunctionCall(t *testing.T) {
1522 o := bytes.NewBufferString("")
1523
1524 p := printer.NewPrettyPrinter(o, " ")
1525 p.Print(&expr.FunctionCall{
1526 Function: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
1527 ArgumentList: &node.ArgumentList{
1528 Arguments: []node.Node{
1529 &node.Argument{
1530 IsReference: true,
1531 Expr: &expr.Variable{VarName: &node.Identifier{Value: "a"}},
1532 },
1533 &node.Argument{
1534 Variadic: true,
1535 Expr: &expr.Variable{VarName: &node.Identifier{Value: "b"}},
1536 },
1537 &node.Argument{
1538 Expr: &expr.Variable{VarName: &node.Identifier{Value: "c"}},
1539 },
1540 },
1541 },
1542 })
1543
1544 expected := `$var(&$a, ...$b, $c)`
1545 actual := o.String()
1546
1547 if expected != actual {
1548 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1549 }
1550}
1551
1552func TestPrintInclude(t *testing.T) {
1553 o := bytes.NewBufferString("")

Callers

nothing calls this directly

Calls 3

PrintMethod · 0.95
NewPrettyPrinterFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…