Declare tests
This commit is contained in:
parent
818199f12e
commit
1e8bc34824
@ -63,3 +63,30 @@ func TestDeclareStmts(t *testing.T) {
|
|||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAltDeclare(t *testing.T) {
|
||||||
|
src := `<? declare(ticks=1): enddeclare;`
|
||||||
|
|
||||||
|
expected := &stmt.StmtList{
|
||||||
|
Stmts: []node.Node{
|
||||||
|
&stmt.Declare{
|
||||||
|
Consts: []node.Node{
|
||||||
|
&stmt.Constant{
|
||||||
|
PhpDocComment: "",
|
||||||
|
ConstantName: &node.Identifier{Value: "ticks"},
|
||||||
|
Expr: &scalar.Lnumber{Value: "1"},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Stmt: &stmt.StmtList{
|
||||||
|
Stmts: []node.Node{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
|
assertEqual(t, expected, actual)
|
||||||
|
|
||||||
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
|
assertEqual(t, expected, actual)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user