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

Function TestPrinterPrintShortList

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

Source from the content-addressed store, hash-verified

2324}
2325
2326func TestPrinterPrintShortList(t *testing.T) {
2327 o := bytes.NewBufferString("")
2328
2329 p := printer.NewPrinter(o)
2330 p.Print(&expr.ShortList{
2331 Items: []node.Node{
2332 &expr.ArrayItem{
2333 Val: &expr.Variable{
2334 VarName: &node.Identifier{Value: "a"},
2335 },
2336 },
2337 &expr.ArrayItem{
2338 Val: &expr.List{
2339 Items: []node.Node{
2340 &expr.ArrayItem{
2341 Val: &expr.Variable{
2342 VarName: &node.Identifier{Value: "b"},
2343 },
2344 },
2345 &expr.ArrayItem{
2346 Val: &expr.Variable{
2347 VarName: &node.Identifier{Value: "c"},
2348 },
2349 },
2350 },
2351 },
2352 },
2353 },
2354 })
2355
2356 expected := `[$a,list($b,$c)]`
2357 actual := o.String()
2358
2359 if expected != actual {
2360 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
2361 }
2362}
2363
2364func TestPrinterPrintStaticCall(t *testing.T) {
2365 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…