test expr
(t *testing.T)
| 358 | // test expr |
| 359 | |
| 360 | func TestParseAndPrintArrayDimFetch(t *testing.T) { |
| 361 | src := `<?php |
| 362 | FOO [ ] ; |
| 363 | FOO [ 1 ] ; |
| 364 | $a [ ] ; |
| 365 | $a [ 1 ] ; |
| 366 | $a { 1 } ; |
| 367 | new $a [ ] ; |
| 368 | new $a [ 1 ] ; |
| 369 | new $a { 1 } ; |
| 370 | "$a[1]test" ; |
| 371 | "${ a [ 1 ] }test" ; |
| 372 | ` |
| 373 | |
| 374 | actual := print(parse(src)) |
| 375 | |
| 376 | if src != actual { |
| 377 | t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | func TestParseAndPrintArrayItem(t *testing.T) { |
| 382 | src := `<?php |