(t *testing.T)
| 1571 | } |
| 1572 | |
| 1573 | func TestPrinterPrintExprArray(t *testing.T) { |
| 1574 | o := bytes.NewBufferString("") |
| 1575 | |
| 1576 | p := printer.NewPrinter(o) |
| 1577 | p.Print(&expr.Array{ |
| 1578 | Items: []node.Node{ |
| 1579 | &expr.ArrayItem{ |
| 1580 | Key: &scalar.String{Value: "'Hello'"}, |
| 1581 | Val: &expr.Variable{ |
| 1582 | VarName: &node.Identifier{Value: "world"}, |
| 1583 | }, |
| 1584 | }, |
| 1585 | &expr.ArrayItem{ |
| 1586 | Key: &scalar.Lnumber{Value: "2"}, |
| 1587 | Val: &expr.Reference{Variable: &expr.Variable{ |
| 1588 | VarName: &node.Identifier{Value: "var"}, |
| 1589 | }}, |
| 1590 | }, |
| 1591 | &expr.ArrayItem{ |
| 1592 | Val: &expr.Variable{ |
| 1593 | VarName: &node.Identifier{Value: "var"}, |
| 1594 | }, |
| 1595 | }, |
| 1596 | }, |
| 1597 | }) |
| 1598 | |
| 1599 | expected := `array('Hello'=>$world,2=>&$var,$var)` |
| 1600 | actual := o.String() |
| 1601 | |
| 1602 | if expected != actual { |
| 1603 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 1604 | } |
| 1605 | } |
| 1606 | |
| 1607 | func TestPrinterPrintExprBitwiseNot(t *testing.T) { |
| 1608 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…