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

Function TestPrinterPrintExprArrayItemWithKey

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

Source from the content-addressed store, hash-verified

1515}
1516
1517func TestPrinterPrintExprArrayItemWithKey(t *testing.T) {
1518 o := bytes.NewBufferString("")
1519
1520 p := printer.NewPrinter(o)
1521 p.Print(&expr.ArrayItem{
1522 Key: &scalar.String{Value: "'Hello'"},
1523 Val: &expr.Variable{
1524 VarName: &node.Identifier{Value: "world"},
1525 },
1526 })
1527
1528 expected := `'Hello'=>$world`
1529 actual := o.String()
1530
1531 if expected != actual {
1532 t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual)
1533 }
1534}
1535
1536func TestPrinterPrintExprArrayItem(t *testing.T) {
1537 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…