| 1521 | } |
| 1522 | |
| 1523 | func TestParseAndPrintComplexString3(t *testing.T) { |
| 1524 | src := `<?php |
| 1525 | "test ${foo}" ; |
| 1526 | "test ${foo[0]}"; |
| 1527 | "test ${foo::$bar}"; |
| 1528 | "test ${foo }" ; |
| 1529 | "test ${foo . 'bar' }" ; |
| 1530 | "test ${foo [ ] }" ; |
| 1531 | "test ${foo [ $b ] }" ; |
| 1532 | "test ${foo [ 1 ] }" ; |
| 1533 | "test ${foo [ 'expr' . $bar ] }" ; |
| 1534 | "test ${$foo }" ; |
| 1535 | "test ${$foo -> bar }" ; |
| 1536 | "test ${$foo -> bar ( ) }" ; |
| 1537 | "test ${$a . '' }" ; |
| 1538 | ` |
| 1539 | |
| 1540 | actual := print(parse(src)) |
| 1541 | |
| 1542 | if src != actual { |
| 1543 | t.Errorf("\nexpected: %s\ngot: %s\n", src, actual) |
| 1544 | } |
| 1545 | } |
| 1546 | |
| 1547 | func TestParseAndPrintComplexString4(t *testing.T) { |
| 1548 | src := `<?php |