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

Function TestPrinterPrintParameter

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

Source from the content-addressed store, hash-verified

139}
140
141func TestPrinterPrintParameter(t *testing.T) {
142 o := bytes.NewBufferString("")
143
144 p := printer.NewPrinter(o)
145 p.Print(&node.Parameter{
146 ByRef: false,
147 Variadic: true,
148 VariableType: &name.FullyQualified{
149 Parts: []node.Node{
150 &name.NamePart{
151 Value: "Foo",
152 },
153 },
154 },
155 Variable: &expr.Variable{
156 VarName: &node.Identifier{Value: "var"},
157 },
158 DefaultValue: &scalar.String{
159 Value: "'default'",
160 },
161 })
162
163 expected := "\\Foo...$var='default'"
164 actual := o.String()
165
166 if expected != actual {
167 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
168 }
169}
170
171func TestPrinterPrintNullable(t *testing.T) {
172 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…