php5 test coverage

This commit is contained in:
z7zmey
2018-02-14 21:02:57 +02:00
parent 75f952ad03
commit 30b6533864
6 changed files with 3463 additions and 2234 deletions

View File

@@ -14,6 +14,29 @@ import (
"github.com/z7zmey/php-parser/php7"
)
func TestEmptyList(t *testing.T) {
src := `<? list() = $b;`
expected := &stmt.StmtList{
Stmts: []node.Node{
&stmt.Expression{
Expr: &assign_op.Assign{
Variable: &expr.List{
Items: []node.Node{},
},
Expression: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
},
},
},
}
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
assertEqual(t, expected, actual)
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
assertEqual(t, expected, actual)
}
func TestList(t *testing.T) {
src := `<? list($a) = $b;`