(t *testing.T)
| 1279 | } |
| 1280 | |
| 1281 | func TestPrintExprArray(t *testing.T) { |
| 1282 | o := bytes.NewBufferString("") |
| 1283 | |
| 1284 | p := printer.NewPrettyPrinter(o, " ") |
| 1285 | p.Print(&expr.Array{ |
| 1286 | Items: []node.Node{ |
| 1287 | &expr.ArrayItem{ |
| 1288 | Key: &scalar.String{Value: "'Hello'"}, |
| 1289 | Val: &expr.Variable{VarName: &node.Identifier{Value: "world"}}, |
| 1290 | }, |
| 1291 | &expr.ArrayItem{ |
| 1292 | Key: &scalar.Lnumber{Value: "2"}, |
| 1293 | Val: &expr.Reference{Variable: &expr.Variable{VarName: &node.Identifier{Value: "var"}}}, |
| 1294 | }, |
| 1295 | &expr.ArrayItem{ |
| 1296 | Val: &expr.Variable{VarName: &node.Identifier{Value: "var"}}, |
| 1297 | }, |
| 1298 | }, |
| 1299 | }) |
| 1300 | |
| 1301 | expected := `array('Hello' => $world, 2 => &$var, $var)` |
| 1302 | actual := o.String() |
| 1303 | |
| 1304 | if expected != actual { |
| 1305 | t.Errorf("\nexpected: %s\ngot: %s\n", expected, actual) |
| 1306 | } |
| 1307 | } |
| 1308 | |
| 1309 | func TestPrintExprBitwiseNot(t *testing.T) { |
| 1310 | o := bytes.NewBufferString("") |
nothing calls this directly
no test coverage detected
searching dependent graphs…