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

Function TestPrintExprClosureUse

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

Source from the content-addressed store, hash-verified

1372}
1373
1374func TestPrintExprClosureUse(t *testing.T) {
1375 o := bytes.NewBufferString("")
1376
1377 p := printer.NewPrettyPrinter(o, " ")
1378 p.Print(&expr.ClosureUse{
1379 Uses: []node.Node{
1380 &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "foo"}}},
1381 &expr.Variable{VarName: &node.Identifier{Value: "bar"}},
1382 },
1383 })
1384
1385 expected := `use (&$foo, $bar)`
1386 actual := o.String()
1387
1388 if expected != actual {
1389 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1390 }
1391}
1392
1393func TestPrintExprClosure(t *testing.T) {
1394 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…