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

Function TestPrintExprArrayItemWithKey

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

Source from the content-addressed store, hash-verified

1246}
1247
1248func TestPrintExprArrayItemWithKey(t *testing.T) {
1249 o := bytes.NewBufferString("")
1250
1251 p := printer.NewPrettyPrinter(o, " ")
1252 p.Print(&expr.ArrayItem{
1253 Key: &scalar.String{Value: "'Hello'"},
1254 Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}},
1255 })
1256
1257 expected := `'Hello' => $world`
1258 actual := o.String()
1259
1260 if expected != actual {
1261 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1262 }
1263}
1264
1265func TestPrintExprArrayItem(t *testing.T) {
1266 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…