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

Function TestPrinterPrintExprArrayDimFetch

printer/printer_test.go:1498–1515  ·  view source on GitHub ↗

expr

(t *testing.T)

Source from the content-addressed store, hash-verified

1496// expr
1497
1498func TestPrinterPrintExprArrayDimFetch(t *testing.T) {
1499 o := bytes.NewBufferString("")
1500
1501 p := printer.NewPrinter(o)
1502 p.Print(&expr.ArrayDimFetch{
1503 Variable: &expr.Variable{
1504 VarName: &node.Identifier{Value: "var"},
1505 },
1506 Dim: &scalar.Lnumber{Value: "1"},
1507 })
1508
1509 expected := `$var[1]`
1510 actual := o.String()
1511
1512 if expected != actual {
1513 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1514 }
1515}
1516
1517func TestPrinterPrintExprArrayItemWithKey(t *testing.T) {
1518 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…