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

Function TestPrintExprArrayDimFetch

printer/pretty_printer_test.go:1231–1246  ·  view source on GitHub ↗

expr

(t *testing.T)

Source from the content-addressed store, hash-verified

1229// expr
1230
1231func TestPrintExprArrayDimFetch(t *testing.T) {
1232 o := bytes.NewBufferString("")
1233
1234 p := printer.NewPrettyPrinter(o, " ")
1235 p.Print(&expr.ArrayDimFetch{
1236 Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}},
1237 Dim: &scalar.Lnumber{Value: "1"},
1238 })
1239
1240 expected := `$var[1]`
1241 actual := o.String()
1242
1243 if expected != actual {
1244 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1245 }
1246}
1247
1248func TestPrintExprArrayItemWithKey(t *testing.T) {
1249 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…