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

Function TestPrintNullable

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

Source from the content-addressed store, hash-verified

147}
148
149func TestPrintNullable(t *testing.T) {
150 o := bytes.NewBufferString("")
151
152 p := printer.NewPrettyPrinter(o, " ")
153 p.Print(&node.Nullable{
154 Expr: &node.Parameter{
155 ByRef: false,
156 Variadic: true,
157 VariableType: &name.FullyQualified{Parts: []node.Node{&name.NamePart{Value: "Foo"}}},
158 Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
159 DefaultValue: &scalar.String{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 TestPrintArgument(t *testing.T) {
172 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…