remove meta.StringVarnameToken

This commit is contained in:
z7zmey
2018-10-29 15:39:15 +02:00
parent 03f6b9e419
commit ef14a6c56b
8 changed files with 83 additions and 48 deletions

View File

@@ -1356,8 +1356,6 @@ func TestParseAndPrintPhp5ComplexString1(t *testing.T) {
func TestParseAndPrintPhp5ComplexString2(t *testing.T) {
src := `<?php
"test ${foo}" ;
"test ${foo[0]}";
"test ${ foo }" ;
"test ${ foo . 'bar' }" ;
"test ${ foo [ ] }" ;
@@ -1377,6 +1375,26 @@ func TestParseAndPrintPhp5ComplexString2(t *testing.T) {
}
func TestParseAndPrintPhp5ComplexString3(t *testing.T) {
src := `<?php
"test ${foo }" ;
"test ${foo . 'bar' }" ;
"test ${foo [ ] }" ;
"test ${foo [ 1 ] }" ;
"test ${foo [ 'expr' . $bar ] }" ;
"test ${$foo }" ;
"test ${$foo -> bar }" ;
"test ${$foo -> bar ( ) }" ;
"test ${$a . '' }" ;
`
actual := printPhp5(parsePhp5(src))
if src != actual {
t.Errorf("\nexpected: %s\ngot: %s\n", src, actual)
}
}
func TestParseAndPrintPhp5ComplexString4(t *testing.T) {
src := `<?php
"test {$foo }" ;
"test {$foo [ ] }" ;

View File

@@ -1465,11 +1465,10 @@ func TestParseAndPrintComplexString1(t *testing.T) {
func TestParseAndPrintComplexString2(t *testing.T) {
src := `<?php
"test ${foo}" ;
"test ${foo[0]}";
"test ${ foo }" ;
"test ${ foo . 'bar' }" ;
"test ${ foo [ ] }" ;
"test ${ foo [ $b ] }" ;
"test ${ foo [ 1 ] }" ;
"test ${ foo [ 'expr' . $bar ] }" ;
"test ${ $foo }" ;
@@ -1486,6 +1485,29 @@ func TestParseAndPrintComplexString2(t *testing.T) {
}
func TestParseAndPrintComplexString3(t *testing.T) {
src := `<?php
"test ${foo}" ;
"test ${foo[0]}";
"test ${foo }" ;
"test ${foo . 'bar' }" ;
"test ${foo [ ] }" ;
"test ${foo [ $b ] }" ;
"test ${foo [ 1 ] }" ;
"test ${foo [ 'expr' . $bar ] }" ;
"test ${$foo }" ;
"test ${$foo -> bar }" ;
"test ${$foo -> bar ( ) }" ;
"test ${$a . '' }" ;
`
actual := print(parse(src))
if src != actual {
t.Errorf("\nexpected: %s\ngot: %s\n", src, actual)
}
}
func TestParseAndPrintComplexString4(t *testing.T) {
src := `<?php
"test {$foo }" ;
"test {$foo [ ] }" ;