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

Function TestPrinterPrintList

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

Source from the content-addressed store, hash-verified

2002}
2003
2004func TestPrinterPrintList(t *testing.T) {
2005 o := bytes.NewBufferString("")
2006
2007 p := printer.NewPrinter(o)
2008 p.Print(&expr.List{
2009 Items: []node.Node{
2010 &expr.ArrayItem{
2011 Val: &expr.Variable{
2012 VarName: &node.Identifier{Value: "a"},
2013 },
2014 },
2015 &expr.ArrayItem{
2016 Val: &expr.List{
2017 Items: []node.Node{
2018 &expr.ArrayItem{
2019 Val: &expr.Variable{
2020 VarName: &node.Identifier{Value: "b"},
2021 },
2022 },
2023 &expr.ArrayItem{
2024 Val: &expr.Variable{
2025 VarName: &node.Identifier{Value: "c"},
2026 },
2027 },
2028 },
2029 },
2030 },
2031 },
2032 })
2033
2034 expected := `list($a,list($b,$c))`
2035 actual := o.String()
2036
2037 if expected != actual {
2038 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
2039 }
2040}
2041
2042func TestPrinterPrintMethodCall(t *testing.T) {
2043 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…