#80 implement Ragel based lexer
This commit is contained in:
@@ -42,7 +42,9 @@ func (n *Declare) GetFreeFloating() *freefloating.Collection {
|
||||
|
||||
// Attributes returns node attributes as map
|
||||
func (n *Declare) Attributes() map[string]interface{} {
|
||||
return nil
|
||||
return map[string]interface{}{
|
||||
"Alt": n.Alt,
|
||||
}
|
||||
}
|
||||
|
||||
// Walk traverses nodes
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestAltIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 3,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,21 +31,21 @@ func TestAltIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 3,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 23,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -65,12 +64,12 @@ func TestAltIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -87,7 +86,7 @@ func TestAltElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 4,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 38,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -95,21 +94,21 @@ func TestAltElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 4,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 38,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -129,21 +128,21 @@ func TestAltElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -164,12 +163,12 @@ func TestAltElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -186,7 +185,7 @@ func TestAltElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 4,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -194,21 +193,21 @@ func TestAltElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 4,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 31,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -227,7 +226,7 @@ func TestAltElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: -1,
|
||||
},
|
||||
Stmt: &stmt.StmtList{
|
||||
@@ -244,12 +243,12 @@ func TestAltElse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -268,7 +267,7 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 6,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 61,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -276,21 +275,21 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 6,
|
||||
StartPos: 6,
|
||||
StartPos: 5,
|
||||
EndPos: 61,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -310,21 +309,21 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -344,21 +343,21 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: -1,
|
||||
StartPos: 33,
|
||||
StartPos: 32,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 41,
|
||||
StartPos: 40,
|
||||
EndPos: 42,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 41,
|
||||
StartPos: 40,
|
||||
EndPos: 42,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -379,7 +378,7 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 5,
|
||||
EndLine: -1,
|
||||
StartPos: 48,
|
||||
StartPos: 47,
|
||||
EndPos: -1,
|
||||
},
|
||||
Stmt: &stmt.StmtList{
|
||||
@@ -396,12 +395,12 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 46,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 46,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -38,7 +37,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -48,7 +47,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 44,
|
||||
},
|
||||
Modifiers: []node.Node{
|
||||
@@ -56,7 +55,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -67,7 +66,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 34,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -75,7 +74,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 30,
|
||||
},
|
||||
Value: "FOO",
|
||||
@@ -84,7 +83,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 34,
|
||||
StartPos: 33,
|
||||
EndPos: 34,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -94,7 +93,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 43,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -102,7 +101,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 39,
|
||||
},
|
||||
Value: "BAR",
|
||||
@@ -111,7 +110,7 @@ func TestClassConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 43,
|
||||
StartPos: 42,
|
||||
EndPos: 43,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -124,7 +123,7 @@ func TestClassConstList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -137,7 +136,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 39,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -145,7 +144,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 39,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -153,7 +152,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -163,7 +162,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 37,
|
||||
},
|
||||
Consts: []node.Node{
|
||||
@@ -171,7 +170,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 27,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -179,7 +178,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 23,
|
||||
},
|
||||
Value: "FOO",
|
||||
@@ -188,7 +187,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -198,7 +197,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 36,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -206,7 +205,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "BAR",
|
||||
@@ -215,7 +214,7 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 36,
|
||||
StartPos: 35,
|
||||
EndPos: 36,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -228,12 +227,12 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 33,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 33,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -38,7 +37,7 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -48,7 +47,7 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 31,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -57,7 +56,7 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 26,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -66,7 +65,7 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -77,12 +76,12 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -95,7 +94,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 75,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -103,7 +102,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 75,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -111,7 +110,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -121,7 +120,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 45,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -130,7 +129,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 40,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -140,7 +139,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 19,
|
||||
},
|
||||
Value: "final",
|
||||
@@ -149,7 +148,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "private",
|
||||
@@ -159,7 +158,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 44,
|
||||
StartPos: 43,
|
||||
EndPos: 45,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -169,7 +168,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 47,
|
||||
StartPos: 46,
|
||||
EndPos: 73,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -178,7 +177,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 66,
|
||||
StartPos: 65,
|
||||
EndPos: 68,
|
||||
},
|
||||
Value: "baz",
|
||||
@@ -188,7 +187,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 47,
|
||||
StartPos: 46,
|
||||
EndPos: 55,
|
||||
},
|
||||
Value: "protected",
|
||||
@@ -198,7 +197,7 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 72,
|
||||
StartPos: 71,
|
||||
EndPos: 73,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -209,12 +208,12 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -227,7 +226,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 48,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -235,7 +234,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 48,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -243,7 +242,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -253,7 +252,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 46,
|
||||
},
|
||||
ReturnsRef: true,
|
||||
@@ -262,7 +261,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 39,
|
||||
StartPos: 38,
|
||||
EndPos: 41,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -272,7 +271,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -281,7 +280,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "static",
|
||||
@@ -291,7 +290,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 45,
|
||||
StartPos: 44,
|
||||
EndPos: 46,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -302,7 +301,7 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -315,7 +314,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 54,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -323,7 +322,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 54,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -331,7 +330,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -341,7 +340,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 52,
|
||||
},
|
||||
ReturnsRef: true,
|
||||
@@ -350,7 +349,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 39,
|
||||
StartPos: 38,
|
||||
EndPos: 41,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -360,7 +359,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -369,7 +368,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "static",
|
||||
@@ -379,7 +378,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 46,
|
||||
StartPos: 45,
|
||||
EndPos: 49,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -387,7 +386,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 46,
|
||||
StartPos: 45,
|
||||
EndPos: 49,
|
||||
},
|
||||
Value: "void",
|
||||
@@ -398,7 +397,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 51,
|
||||
StartPos: 50,
|
||||
EndPos: 52,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -409,7 +408,7 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -422,7 +421,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 56,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -430,7 +429,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 56,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -438,7 +437,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -448,7 +447,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "abstract",
|
||||
@@ -459,7 +458,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 54,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -468,7 +467,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 49,
|
||||
StartPos: 48,
|
||||
EndPos: 51,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -478,7 +477,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 31,
|
||||
},
|
||||
Value: "abstract",
|
||||
@@ -487,7 +486,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 33,
|
||||
StartPos: 32,
|
||||
EndPos: 38,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -497,7 +496,7 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 54,
|
||||
StartPos: 53,
|
||||
EndPos: 54,
|
||||
},
|
||||
},
|
||||
@@ -507,12 +506,12 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -525,7 +524,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 53,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -533,7 +532,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 53,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -541,7 +540,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -551,7 +550,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "abstract",
|
||||
@@ -562,7 +561,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 51,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -571,7 +570,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 40,
|
||||
StartPos: 39,
|
||||
EndPos: 42,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -581,7 +580,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -591,7 +590,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 47,
|
||||
StartPos: 46,
|
||||
EndPos: 50,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -599,7 +598,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 47,
|
||||
StartPos: 46,
|
||||
EndPos: 50,
|
||||
},
|
||||
Value: "void",
|
||||
@@ -610,7 +609,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 51,
|
||||
StartPos: 50,
|
||||
EndPos: 51,
|
||||
},
|
||||
},
|
||||
@@ -620,7 +619,7 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -23,7 +22,7 @@ func TestSimpleClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -31,7 +30,7 @@ func TestSimpleClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -39,7 +38,7 @@ func TestSimpleClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -49,12 +48,12 @@ func TestSimpleClass(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -67,7 +66,7 @@ func TestAbstractClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -75,7 +74,7 @@ func TestAbstractClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -83,7 +82,7 @@ func TestAbstractClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -93,7 +92,7 @@ func TestAbstractClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "abstract",
|
||||
@@ -104,12 +103,12 @@ func TestAbstractClass(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -122,7 +121,7 @@ func TestClassExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 34,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -130,7 +129,7 @@ func TestClassExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 34,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -138,7 +137,7 @@ func TestClassExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -148,7 +147,7 @@ func TestClassExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Value: "final",
|
||||
@@ -158,14 +157,14 @@ func TestClassExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 30,
|
||||
},
|
||||
ClassName: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 30,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -173,7 +172,7 @@ func TestClassExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 30,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -186,12 +185,12 @@ func TestClassExtends(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -204,7 +203,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 37,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -212,7 +211,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 37,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -220,7 +219,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -230,7 +229,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Value: "final",
|
||||
@@ -240,7 +239,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 33,
|
||||
},
|
||||
InterfaceNames: []node.Node{
|
||||
@@ -248,7 +247,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -256,7 +255,7 @@ func TestClassImplement(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -270,12 +269,12 @@ func TestClassImplement(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -288,7 +287,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 42,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -296,7 +295,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 42,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -304,7 +303,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -314,7 +313,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 8,
|
||||
},
|
||||
Value: "final",
|
||||
@@ -324,7 +323,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 38,
|
||||
},
|
||||
InterfaceNames: []node.Node{
|
||||
@@ -332,7 +331,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -340,7 +339,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -351,7 +350,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 36,
|
||||
StartPos: 35,
|
||||
EndPos: 38,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -359,7 +358,7 @@ func TestClassImplements(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 36,
|
||||
StartPos: 35,
|
||||
EndPos: 38,
|
||||
},
|
||||
Value: "baz",
|
||||
@@ -373,12 +372,12 @@ func TestClassImplements(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -391,7 +390,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 51,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -399,21 +398,21 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 51,
|
||||
},
|
||||
Expr: &expr.New{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 50,
|
||||
},
|
||||
Class: &stmt.Class{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 50,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -421,7 +420,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
},
|
||||
@@ -429,14 +428,14 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 26,
|
||||
},
|
||||
ClassName: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 26,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -444,7 +443,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 26,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -456,7 +455,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 46,
|
||||
},
|
||||
InterfaceNames: []node.Node{
|
||||
@@ -464,7 +463,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 39,
|
||||
StartPos: 38,
|
||||
EndPos: 41,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -472,7 +471,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 39,
|
||||
StartPos: 38,
|
||||
EndPos: 41,
|
||||
},
|
||||
Value: "bar",
|
||||
@@ -483,7 +482,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 44,
|
||||
StartPos: 43,
|
||||
EndPos: 46,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -491,7 +490,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 44,
|
||||
StartPos: 43,
|
||||
EndPos: 46,
|
||||
},
|
||||
Value: "baz",
|
||||
@@ -507,7 +506,7 @@ func TestAnonimousClass(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Consts: []node.Node{
|
||||
@@ -38,7 +37,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 16,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -46,7 +45,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "FOO",
|
||||
@@ -55,7 +54,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -65,7 +64,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 25,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -73,7 +72,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "BAR",
|
||||
@@ -82,7 +81,7 @@ func TestConstList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 25,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -93,12 +92,12 @@ func TestConstList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestContinueEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestContinueEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 26,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -46,7 +45,7 @@ func TestContinueEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 26,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -54,7 +53,7 @@ func TestContinueEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 24,
|
||||
},
|
||||
},
|
||||
@@ -64,12 +63,12 @@ func TestContinueEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -82,7 +81,7 @@ func TestContinueLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -90,14 +89,14 @@ func TestContinueLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 28,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -106,7 +105,7 @@ func TestContinueLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -114,14 +113,14 @@ func TestContinueLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 26,
|
||||
},
|
||||
Expr: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 25,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -133,12 +132,12 @@ func TestContinueLight(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -151,7 +150,7 @@ func TestContinue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 29,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -159,14 +158,14 @@ func TestContinue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 29,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -175,7 +174,7 @@ func TestContinue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 29,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -183,14 +182,14 @@ func TestContinue(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 27,
|
||||
},
|
||||
Expr: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 25,
|
||||
},
|
||||
Value: "3",
|
||||
@@ -202,12 +201,12 @@ func TestContinue(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 20,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 20,
|
||||
},
|
||||
Consts: []node.Node{
|
||||
@@ -38,7 +37,7 @@ func TestDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 18,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -46,7 +45,7 @@ func TestDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "ticks",
|
||||
@@ -55,7 +54,7 @@ func TestDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -66,7 +65,7 @@ func TestDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 20,
|
||||
},
|
||||
},
|
||||
@@ -74,12 +73,12 @@ func TestDeclare(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -92,7 +91,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 38,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -100,7 +99,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 38,
|
||||
},
|
||||
Consts: []node.Node{
|
||||
@@ -108,7 +107,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 18,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -116,7 +115,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "ticks",
|
||||
@@ -125,7 +124,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -135,7 +134,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 34,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -143,7 +142,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "strict_types",
|
||||
@@ -152,7 +151,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 34,
|
||||
StartPos: 33,
|
||||
EndPos: 34,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -163,7 +162,7 @@ func TestDeclareStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 38,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -172,12 +171,12 @@ func TestDeclareStmts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -190,7 +189,7 @@ func TestAltDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 32,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -198,7 +197,7 @@ func TestAltDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 32,
|
||||
},
|
||||
Consts: []node.Node{
|
||||
@@ -206,7 +205,7 @@ func TestAltDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 18,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -214,7 +213,7 @@ func TestAltDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "ticks",
|
||||
@@ -223,7 +222,7 @@ func TestAltDeclare(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 18,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -244,12 +243,12 @@ func TestAltDeclare(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestDo(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestDo(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Stmt: &stmt.StmtList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 8,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -46,7 +45,7 @@ func TestDo(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -55,12 +54,12 @@ func TestDo(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestSimpleEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,7 +31,7 @@ func TestSimpleEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 14,
|
||||
},
|
||||
Exprs: []node.Node{
|
||||
@@ -40,14 +39,14 @@ func TestSimpleEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -57,7 +56,7 @@ func TestSimpleEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -67,12 +66,12 @@ func TestSimpleEcho(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -85,7 +84,7 @@ func TestEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -93,7 +92,7 @@ func TestEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Exprs: []node.Node{
|
||||
@@ -101,14 +100,14 @@ func TestEcho(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 9,
|
||||
StartPos: 8,
|
||||
EndPos: 10,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -119,12 +118,12 @@ func TestEcho(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestExpression(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestExpression(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
Expr: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 4,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -46,12 +45,12 @@ func TestExpression(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -27,7 +26,7 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 38,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -35,7 +34,7 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 38,
|
||||
},
|
||||
Init: []node.Node{
|
||||
@@ -43,21 +42,21 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 13,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "i",
|
||||
@@ -67,7 +66,7 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 13,
|
||||
},
|
||||
Value: "0",
|
||||
@@ -79,21 +78,21 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 22,
|
||||
},
|
||||
Left: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 17,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 17,
|
||||
},
|
||||
Value: "i",
|
||||
@@ -103,7 +102,7 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "10",
|
||||
@@ -115,21 +114,21 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 28,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 26,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 26,
|
||||
},
|
||||
Value: "i",
|
||||
@@ -140,21 +139,21 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 34,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "i",
|
||||
@@ -166,7 +165,7 @@ func TestFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 38,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -175,12 +174,12 @@ func TestFor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -193,7 +192,7 @@ func TestAltFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 33,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -201,7 +200,7 @@ func TestAltFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 33,
|
||||
},
|
||||
Cond: []node.Node{
|
||||
@@ -209,21 +208,21 @@ func TestAltFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 16,
|
||||
},
|
||||
Left: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "i",
|
||||
@@ -233,7 +232,7 @@ func TestAltFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "10",
|
||||
@@ -245,21 +244,21 @@ func TestAltFor(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 22,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "i",
|
||||
@@ -280,12 +279,12 @@ func TestAltFor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,21 +29,21 @@ func TestForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -54,14 +53,14 @@ func TestForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -71,7 +70,7 @@ func TestForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -80,12 +79,12 @@ func TestForeach(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -98,7 +97,7 @@ func TestForeachExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -106,14 +105,14 @@ func TestForeachExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 24,
|
||||
},
|
||||
Expr: &expr.ShortArray{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Items: []node.Node{},
|
||||
@@ -122,14 +121,14 @@ func TestForeachExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -139,7 +138,7 @@ func TestForeachExpr(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -148,12 +147,12 @@ func TestForeachExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -166,7 +165,7 @@ func TestAltForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 35,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -174,21 +173,21 @@ func TestAltForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 35,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -198,14 +197,14 @@ func TestAltForeach(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -224,12 +223,12 @@ func TestAltForeach(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -242,7 +241,7 @@ func TestForeachWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -250,21 +249,21 @@ func TestForeachWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -274,14 +273,14 @@ func TestForeachWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "k",
|
||||
@@ -291,14 +290,14 @@ func TestForeachWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 26,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 26,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -308,7 +307,7 @@ func TestForeachWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -317,12 +316,12 @@ func TestForeachWithKey(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -335,7 +334,7 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -343,14 +342,14 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Expr: &expr.ShortArray{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Items: []node.Node{},
|
||||
@@ -359,14 +358,14 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "k",
|
||||
@@ -376,14 +375,14 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 26,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 26,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -393,7 +392,7 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -402,12 +401,12 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -420,7 +419,7 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -428,21 +427,21 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -452,14 +451,14 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "k",
|
||||
@@ -469,21 +468,21 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -494,7 +493,7 @@ func TestForeachWithRef(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -503,12 +502,12 @@ func TestForeachWithRef(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -521,7 +520,7 @@ func TestForeachWithList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 36,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -529,21 +528,21 @@ func TestForeachWithList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 36,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 14,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -553,14 +552,14 @@ func TestForeachWithList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "k",
|
||||
@@ -570,7 +569,7 @@ func TestForeachWithList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 32,
|
||||
},
|
||||
Items: []node.Node{
|
||||
@@ -578,21 +577,21 @@ func TestForeachWithList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 31,
|
||||
},
|
||||
Val: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 31,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 31,
|
||||
},
|
||||
Value: "v",
|
||||
@@ -605,7 +604,7 @@ func TestForeachWithList(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 35,
|
||||
StartPos: 34,
|
||||
EndPos: 36,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -614,12 +613,12 @@ func TestForeachWithList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -24,7 +23,7 @@ func TestSimpleFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 20,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -32,7 +31,7 @@ func TestSimpleFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 20,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -41,7 +40,7 @@ func TestSimpleFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -51,12 +50,12 @@ func TestSimpleFunction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -69,7 +68,7 @@ func TestFunctionReturn(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 27,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -77,7 +76,7 @@ func TestFunctionReturn(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 27,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -86,7 +85,7 @@ func TestFunctionReturn(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -96,7 +95,7 @@ func TestFunctionReturn(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 26,
|
||||
},
|
||||
},
|
||||
@@ -105,12 +104,12 @@ func TestFunctionReturn(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -123,7 +122,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 51,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -131,7 +130,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 51,
|
||||
},
|
||||
ReturnsRef: false,
|
||||
@@ -140,7 +139,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 13,
|
||||
StartPos: 12,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -150,7 +149,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 24,
|
||||
},
|
||||
ByRef: false,
|
||||
@@ -159,7 +158,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 17,
|
||||
StartPos: 16,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "array",
|
||||
@@ -168,14 +167,14 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -186,7 +185,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 37,
|
||||
},
|
||||
ByRef: false,
|
||||
@@ -195,7 +194,7 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 34,
|
||||
},
|
||||
Value: "callable",
|
||||
@@ -204,14 +203,14 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 36,
|
||||
StartPos: 35,
|
||||
EndPos: 37,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 36,
|
||||
StartPos: 35,
|
||||
EndPos: 37,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -224,21 +223,21 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 41,
|
||||
StartPos: 40,
|
||||
EndPos: 50,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 48,
|
||||
StartPos: 47,
|
||||
EndPos: 49,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 48,
|
||||
StartPos: 47,
|
||||
EndPos: 49,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -250,12 +249,12 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -268,7 +267,7 @@ func TestRefFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -276,7 +275,7 @@ func TestRefFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
ReturnsRef: true,
|
||||
@@ -285,7 +284,7 @@ func TestRefFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -295,14 +294,14 @@ func TestRefFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Expr: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -313,12 +312,12 @@ func TestRefFunction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -331,7 +330,7 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 27,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -339,7 +338,7 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 27,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -348,7 +347,7 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -357,7 +356,7 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 24,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -365,7 +364,7 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 24,
|
||||
},
|
||||
Value: "void",
|
||||
@@ -377,7 +376,7 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestGlobal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestGlobal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -38,14 +37,14 @@ func TestGlobal(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -56,12 +55,12 @@ func TestGlobal(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -74,7 +73,7 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 32,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -82,7 +81,7 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 32,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -90,14 +89,14 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -107,14 +106,14 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -124,21 +123,21 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 21,
|
||||
},
|
||||
VarName: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 21,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 21,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -149,21 +148,21 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 31,
|
||||
},
|
||||
VarName: &expr.FunctionCall{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 30,
|
||||
},
|
||||
Function: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -171,7 +170,7 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -182,7 +181,7 @@ func TestGlobalVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
},
|
||||
@@ -193,12 +192,12 @@ func TestGlobalVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -20,7 +19,7 @@ func TestGotoLabel(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -28,14 +27,14 @@ func TestGotoLabel(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
LabelName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 4,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -45,14 +44,14 @@ func TestGotoLabel(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 13,
|
||||
},
|
||||
Label: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -61,12 +60,12 @@ func TestGotoLabel(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -20,7 +19,7 @@ func TestHaltCompiler(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -28,19 +27,19 @@ func TestHaltCompiler(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,21 +29,21 @@ func TestIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -54,7 +53,7 @@ func TestIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -63,12 +62,12 @@ func TestIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -81,7 +80,7 @@ func TestElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -89,21 +88,21 @@ func TestElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 28,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -113,7 +112,7 @@ func TestElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -123,21 +122,21 @@ func TestElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 28,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -147,7 +146,7 @@ func TestElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -158,12 +157,12 @@ func TestElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -176,7 +175,7 @@ func TestElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -184,21 +183,21 @@ func TestElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -208,7 +207,7 @@ func TestElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -217,14 +216,14 @@ func TestElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmt: &stmt.StmtList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -234,12 +233,12 @@ func TestElse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -252,7 +251,7 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 51,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -260,21 +259,21 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 51,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -284,7 +283,7 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -294,21 +293,21 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 28,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -318,7 +317,7 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -328,21 +327,21 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 43,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 39,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 39,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -352,7 +351,7 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 42,
|
||||
StartPos: 41,
|
||||
EndPos: 43,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -363,14 +362,14 @@ func TestElseElseIf(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 45,
|
||||
StartPos: 44,
|
||||
EndPos: 51,
|
||||
},
|
||||
Stmt: &stmt.StmtList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 50,
|
||||
StartPos: 49,
|
||||
EndPos: 51,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -380,12 +379,12 @@ func TestElseElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -398,7 +397,7 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 52,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -406,21 +405,21 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 52,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 8,
|
||||
StartPos: 7,
|
||||
EndPos: 9,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -430,7 +429,7 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 12,
|
||||
StartPos: 11,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -440,21 +439,21 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 28,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 24,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -464,7 +463,7 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 27,
|
||||
StartPos: 26,
|
||||
EndPos: 28,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -475,28 +474,28 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 30,
|
||||
StartPos: 29,
|
||||
EndPos: 52,
|
||||
},
|
||||
Stmt: &stmt.If{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 35,
|
||||
StartPos: 34,
|
||||
EndPos: 52,
|
||||
},
|
||||
Cond: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 39,
|
||||
StartPos: 38,
|
||||
EndPos: 40,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 39,
|
||||
StartPos: 38,
|
||||
EndPos: 40,
|
||||
},
|
||||
Value: "c",
|
||||
@@ -506,7 +505,7 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 43,
|
||||
StartPos: 42,
|
||||
EndPos: 44,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -515,14 +514,14 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 46,
|
||||
StartPos: 45,
|
||||
EndPos: 52,
|
||||
},
|
||||
Stmt: &stmt.StmtList{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 51,
|
||||
StartPos: 50,
|
||||
EndPos: 52,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -534,12 +533,12 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -20,7 +19,7 @@ func TestInlineHtml(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -28,7 +27,7 @@ func TestInlineHtml(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 5,
|
||||
},
|
||||
},
|
||||
@@ -36,20 +35,20 @@ func TestInlineHtml(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 7,
|
||||
StartPos: 5,
|
||||
EndPos: 17,
|
||||
},
|
||||
Value: "<div></div>",
|
||||
Value: " <div></div>",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestInterface(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestInterface(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -38,7 +37,7 @@ func TestInterface(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -48,12 +47,12 @@ func TestInterface(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -66,7 +65,7 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -74,7 +73,7 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 31,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -82,7 +81,7 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -91,7 +90,7 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 28,
|
||||
},
|
||||
InterfaceNames: []node.Node{
|
||||
@@ -99,7 +98,7 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -107,7 +106,7 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -121,12 +120,12 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -139,7 +138,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 36,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -147,7 +146,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 36,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -155,7 +154,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -164,7 +163,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 33,
|
||||
},
|
||||
InterfaceNames: []node.Node{
|
||||
@@ -172,7 +171,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -180,7 +179,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 26,
|
||||
StartPos: 25,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -191,7 +190,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -199,7 +198,7 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -213,12 +212,12 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestNamespace(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestNamespace(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
NamespaceName: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -45,7 +44,7 @@ func TestNamespace(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -56,12 +55,12 @@ func TestNamespace(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -74,7 +73,7 @@ func TestNamespaceStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -82,14 +81,14 @@ func TestNamespaceStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 19,
|
||||
},
|
||||
NamespaceName: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -97,7 +96,7 @@ func TestNamespaceStmts(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -109,12 +108,12 @@ func TestNamespaceStmts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -127,7 +126,7 @@ func TestAnonymousNamespace(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -135,7 +134,7 @@ func TestAnonymousNamespace(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -143,12 +142,12 @@ func TestAnonymousNamespace(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -23,7 +22,7 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -31,7 +30,7 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 22,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -39,7 +38,7 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -49,7 +48,7 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 21,
|
||||
},
|
||||
Modifiers: []node.Node{
|
||||
@@ -57,7 +56,7 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 17,
|
||||
},
|
||||
Value: "var",
|
||||
@@ -68,7 +67,7 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -76,14 +75,14 @@ func TestProperty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -97,12 +96,12 @@ func TestProperty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -115,7 +114,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 40,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -123,7 +122,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 40,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -131,7 +130,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -141,7 +140,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 39,
|
||||
},
|
||||
Modifiers: []node.Node{
|
||||
@@ -149,7 +148,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -158,7 +157,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "static",
|
||||
@@ -169,7 +168,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -177,14 +176,14 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -195,7 +194,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 33,
|
||||
StartPos: 32,
|
||||
EndPos: 38,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -203,14 +202,14 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 33,
|
||||
StartPos: 32,
|
||||
EndPos: 34,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 33,
|
||||
StartPos: 32,
|
||||
EndPos: 34,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -220,7 +219,7 @@ func TestProperties(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 38,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -233,12 +232,12 @@ func TestProperties(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -251,7 +250,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 40,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -259,7 +258,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 40,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -267,7 +266,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "foo",
|
||||
@@ -277,7 +276,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 39,
|
||||
},
|
||||
Modifiers: []node.Node{
|
||||
@@ -285,7 +284,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -294,7 +293,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "static",
|
||||
@@ -305,7 +304,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 34,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -313,14 +312,14 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -330,7 +329,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 34,
|
||||
StartPos: 33,
|
||||
EndPos: 34,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -340,7 +339,7 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 38,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -348,14 +347,14 @@ func TestProperties2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 38,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 37,
|
||||
StartPos: 36,
|
||||
EndPos: 38,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -369,12 +368,12 @@ func TestProperties2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestStaticVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestStaticVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -38,21 +37,21 @@ func TestStaticVar(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -64,12 +63,12 @@ func TestStaticVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -82,7 +81,7 @@ func TestStaticVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -90,7 +89,7 @@ func TestStaticVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -98,21 +97,21 @@ func TestStaticVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -123,21 +122,21 @@ func TestStaticVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 20,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -147,7 +146,7 @@ func TestStaticVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -158,12 +157,12 @@ func TestStaticVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -176,7 +175,7 @@ func TestStaticVars2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -184,7 +183,7 @@ func TestStaticVars2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 21,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -192,21 +191,21 @@ func TestStaticVars2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 16,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -216,7 +215,7 @@ func TestStaticVars2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 16,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -226,21 +225,21 @@ func TestStaticVars2(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Variable: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 19,
|
||||
StartPos: 18,
|
||||
EndPos: 20,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -252,12 +251,12 @@ func TestStaticVars2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -28,7 +27,7 @@ func TestAltSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 6,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 65,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -36,14 +35,116 @@ func TestAltSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 6,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 65,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "1",
|
||||
},
|
||||
CaseList: &stmt.CaseList{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 22,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cases: []node.Node{
|
||||
&stmt.Case{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 22,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 27,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "1",
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
&stmt.Default{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: -1,
|
||||
StartPos: 33,
|
||||
EndPos: -1,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
&stmt.Case{
|
||||
Position: &position.Position{
|
||||
StartLine: 5,
|
||||
EndLine: -1,
|
||||
StartPos: 45,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 5,
|
||||
EndLine: 5,
|
||||
StartPos: 50,
|
||||
EndPos: 51,
|
||||
},
|
||||
Value: "2",
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestAltSwitchSemicolon(t *testing.T) {
|
||||
src := `<?
|
||||
switch (1) :;
|
||||
case 1;
|
||||
case 2;
|
||||
endswitch;
|
||||
`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 6,
|
||||
EndPos: 54,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.AltSwitch{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 6,
|
||||
EndPos: 54,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 14,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -68,108 +169,6 @@ func TestAltSwitch(t *testing.T) {
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 28,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "1",
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
&stmt.Default{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: -1,
|
||||
StartPos: 34,
|
||||
EndPos: -1,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
&stmt.Case{
|
||||
Position: &position.Position{
|
||||
StartLine: 5,
|
||||
EndLine: -1,
|
||||
StartPos: 46,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 5,
|
||||
EndLine: 5,
|
||||
StartPos: 51,
|
||||
EndPos: 51,
|
||||
},
|
||||
Value: "2",
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
func TestAltSwitchSemicolon(t *testing.T) {
|
||||
src := `<?
|
||||
switch (1) :;
|
||||
case 1;
|
||||
case 2;
|
||||
endswitch;
|
||||
`
|
||||
|
||||
expected := &node.Root{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 7,
|
||||
EndPos: 54,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
&stmt.AltSwitch{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 7,
|
||||
EndPos: 54,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 15,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "1",
|
||||
},
|
||||
CaseList: &stmt.CaseList{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 24,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cases: []node.Node{
|
||||
&stmt.Case{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: -1,
|
||||
StartPos: 24,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 29,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -180,14 +179,14 @@ func TestAltSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: -1,
|
||||
StartPos: 35,
|
||||
StartPos: 34,
|
||||
EndPos: -1,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 40,
|
||||
StartPos: 39,
|
||||
EndPos: 40,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -200,12 +199,12 @@ func TestAltSwitchSemicolon(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -223,7 +222,7 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 58,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -231,14 +230,14 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 58,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -247,7 +246,7 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 58,
|
||||
},
|
||||
Cases: []node.Node{
|
||||
@@ -255,14 +254,14 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 36,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 28,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -272,7 +271,7 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 36,
|
||||
},
|
||||
},
|
||||
@@ -282,14 +281,14 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 41,
|
||||
StartPos: 40,
|
||||
EndPos: 54,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 46,
|
||||
StartPos: 45,
|
||||
EndPos: 46,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -299,7 +298,7 @@ func TestSwitch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 49,
|
||||
StartPos: 48,
|
||||
EndPos: 54,
|
||||
},
|
||||
},
|
||||
@@ -311,12 +310,12 @@ func TestSwitch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -334,7 +333,7 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 59,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -342,14 +341,14 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 59,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 15,
|
||||
StartPos: 14,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -358,7 +357,7 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 5,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 59,
|
||||
},
|
||||
Cases: []node.Node{
|
||||
@@ -366,14 +365,14 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 24,
|
||||
StartPos: 23,
|
||||
EndPos: 37,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -383,7 +382,7 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 3,
|
||||
EndLine: 3,
|
||||
StartPos: 32,
|
||||
StartPos: 31,
|
||||
EndPos: 37,
|
||||
},
|
||||
},
|
||||
@@ -393,14 +392,14 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 42,
|
||||
StartPos: 41,
|
||||
EndPos: 55,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 47,
|
||||
StartPos: 46,
|
||||
EndPos: 47,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -410,7 +409,7 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 4,
|
||||
EndLine: 4,
|
||||
StartPos: 50,
|
||||
StartPos: 49,
|
||||
EndPos: 55,
|
||||
},
|
||||
},
|
||||
@@ -422,12 +421,12 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -21,7 +20,7 @@ func TestThrow(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -29,21 +28,21 @@ func TestThrow(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 12,
|
||||
},
|
||||
Expr: &expr.Variable{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -53,12 +52,12 @@ func TestThrow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -20,7 +19,7 @@ func TestTrait(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -28,7 +27,7 @@ func TestTrait(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 15,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -36,7 +35,7 @@ func TestTrait(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -46,12 +45,12 @@ func TestTrait(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 25,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,7 +29,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 25,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -38,7 +37,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -48,7 +47,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 23,
|
||||
},
|
||||
Traits: []node.Node{
|
||||
@@ -56,7 +55,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -64,7 +63,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -76,7 +75,7 @@ func TestTraitUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 23,
|
||||
StartPos: 22,
|
||||
EndPos: 23,
|
||||
},
|
||||
},
|
||||
@@ -86,12 +85,12 @@ func TestTraitUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -104,7 +103,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -112,7 +111,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 30,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -120,7 +119,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -130,7 +129,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 28,
|
||||
},
|
||||
Traits: []node.Node{
|
||||
@@ -138,7 +137,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -146,7 +145,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -157,7 +156,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -165,7 +164,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -177,7 +176,7 @@ func TestTraitsUse(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 28,
|
||||
},
|
||||
},
|
||||
@@ -187,12 +186,12 @@ func TestTraitsUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -205,7 +204,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 32,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -213,7 +212,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 32,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -221,7 +220,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -231,7 +230,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 30,
|
||||
},
|
||||
Traits: []node.Node{
|
||||
@@ -239,7 +238,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -247,7 +246,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -258,7 +257,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -266,7 +265,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -278,7 +277,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 30,
|
||||
},
|
||||
},
|
||||
@@ -288,12 +287,12 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -306,7 +305,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 48,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -314,7 +313,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 48,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -322,7 +321,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -332,7 +331,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 46,
|
||||
},
|
||||
Traits: []node.Node{
|
||||
@@ -340,7 +339,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -348,7 +347,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -359,7 +358,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -367,7 +366,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -379,7 +378,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 46,
|
||||
},
|
||||
Adaptations: []node.Node{
|
||||
@@ -387,21 +386,21 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 43,
|
||||
},
|
||||
Ref: &stmt.TraitMethodRef{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Method: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Value: "one",
|
||||
@@ -411,7 +410,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 43,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -425,12 +424,12 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -443,7 +442,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 52,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -451,7 +450,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 52,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -459,7 +458,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -469,7 +468,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 50,
|
||||
},
|
||||
Traits: []node.Node{
|
||||
@@ -477,7 +476,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -485,7 +484,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -496,7 +495,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -504,7 +503,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -516,7 +515,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 50,
|
||||
},
|
||||
Adaptations: []node.Node{
|
||||
@@ -524,21 +523,21 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 47,
|
||||
},
|
||||
Ref: &stmt.TraitMethodRef{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Method: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Value: "one",
|
||||
@@ -548,7 +547,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 43,
|
||||
},
|
||||
Value: "public",
|
||||
@@ -557,7 +556,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 45,
|
||||
StartPos: 44,
|
||||
EndPos: 47,
|
||||
},
|
||||
Value: "two",
|
||||
@@ -571,12 +570,12 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -589,7 +588,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 80,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -597,7 +596,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 80,
|
||||
},
|
||||
PhpDocComment: "",
|
||||
@@ -605,7 +604,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 12,
|
||||
},
|
||||
Value: "Foo",
|
||||
@@ -615,7 +614,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 78,
|
||||
},
|
||||
Traits: []node.Node{
|
||||
@@ -623,7 +622,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -631,7 +630,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 20,
|
||||
StartPos: 19,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -642,7 +641,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -650,7 +649,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 25,
|
||||
StartPos: 24,
|
||||
EndPos: 27,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -662,7 +661,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 29,
|
||||
StartPos: 28,
|
||||
EndPos: 78,
|
||||
},
|
||||
Adaptations: []node.Node{
|
||||
@@ -670,21 +669,21 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 58,
|
||||
},
|
||||
Ref: &stmt.TraitMethodRef{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 38,
|
||||
},
|
||||
Trait: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -692,7 +691,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 33,
|
||||
},
|
||||
Value: "Bar",
|
||||
@@ -703,7 +702,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 36,
|
||||
StartPos: 35,
|
||||
EndPos: 38,
|
||||
},
|
||||
Value: "one",
|
||||
@@ -714,7 +713,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 50,
|
||||
StartPos: 49,
|
||||
EndPos: 52,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -722,7 +721,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 50,
|
||||
StartPos: 49,
|
||||
EndPos: 52,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -733,7 +732,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 55,
|
||||
StartPos: 54,
|
||||
EndPos: 58,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -741,7 +740,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 55,
|
||||
StartPos: 54,
|
||||
EndPos: 58,
|
||||
},
|
||||
Value: "Quux",
|
||||
@@ -754,21 +753,21 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 61,
|
||||
StartPos: 60,
|
||||
EndPos: 75,
|
||||
},
|
||||
Ref: &stmt.TraitMethodRef{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 61,
|
||||
StartPos: 60,
|
||||
EndPos: 68,
|
||||
},
|
||||
Trait: &name.Name{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 61,
|
||||
StartPos: 60,
|
||||
EndPos: 63,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -776,7 +775,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 61,
|
||||
StartPos: 60,
|
||||
EndPos: 63,
|
||||
},
|
||||
Value: "Baz",
|
||||
@@ -787,7 +786,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 66,
|
||||
StartPos: 65,
|
||||
EndPos: 68,
|
||||
},
|
||||
Value: "one",
|
||||
@@ -797,7 +796,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 73,
|
||||
StartPos: 72,
|
||||
EndPos: 75,
|
||||
},
|
||||
Value: "two",
|
||||
@@ -811,12 +810,12 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -25,7 +24,7 @@ func TestTry(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: -1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: -1,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -33,7 +32,7 @@ func TestTry(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: -1,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: -1,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -42,12 +41,12 @@ func TestTry(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -62,7 +61,7 @@ func TestTryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 36,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -70,7 +69,7 @@ func TestTryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 36,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -79,7 +78,7 @@ func TestTryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 36,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -87,7 +86,7 @@ func TestTryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -95,7 +94,7 @@ func TestTryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "Exception",
|
||||
@@ -107,14 +106,14 @@ func TestTryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -127,12 +126,12 @@ func TestTryCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -147,7 +146,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 53,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -155,7 +154,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 53,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -164,7 +163,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 53,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -172,7 +171,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -180,7 +179,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "Exception",
|
||||
@@ -191,7 +190,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 46,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -199,7 +198,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 46,
|
||||
},
|
||||
Value: "RuntimeException",
|
||||
@@ -211,14 +210,14 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 48,
|
||||
StartPos: 47,
|
||||
EndPos: 49,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 48,
|
||||
StartPos: 47,
|
||||
EndPos: 49,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -231,7 +230,7 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -246,7 +245,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 67,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -254,7 +253,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 67,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -263,7 +262,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 36,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -271,7 +270,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -279,7 +278,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "Exception",
|
||||
@@ -291,14 +290,14 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -310,7 +309,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 67,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -318,7 +317,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 45,
|
||||
StartPos: 44,
|
||||
EndPos: 60,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -326,7 +325,7 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 45,
|
||||
StartPos: 44,
|
||||
EndPos: 60,
|
||||
},
|
||||
Value: "RuntimeException",
|
||||
@@ -338,14 +337,14 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 62,
|
||||
StartPos: 61,
|
||||
EndPos: 63,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 62,
|
||||
StartPos: 61,
|
||||
EndPos: 63,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -358,12 +357,12 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -378,7 +377,7 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 47,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -386,7 +385,7 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 7,
|
||||
StartPos: 6,
|
||||
EndPos: 47,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -395,7 +394,7 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 36,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -403,7 +402,7 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -411,7 +410,7 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 21,
|
||||
StartPos: 20,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "Exception",
|
||||
@@ -423,14 +422,14 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 31,
|
||||
StartPos: 30,
|
||||
EndPos: 32,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -443,7 +442,7 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 2,
|
||||
EndLine: 2,
|
||||
StartPos: 38,
|
||||
StartPos: 37,
|
||||
EndPos: 47,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -452,12 +451,12 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -470,7 +469,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 107,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -478,7 +477,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 107,
|
||||
},
|
||||
Stmts: []node.Node{},
|
||||
@@ -487,7 +486,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 33,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -495,7 +494,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 26,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -503,7 +502,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 18,
|
||||
StartPos: 17,
|
||||
EndPos: 26,
|
||||
},
|
||||
Value: "Exception",
|
||||
@@ -515,14 +514,14 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 29,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 28,
|
||||
StartPos: 27,
|
||||
EndPos: 29,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -534,7 +533,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 35,
|
||||
StartPos: 34,
|
||||
EndPos: 65,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -542,7 +541,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 42,
|
||||
StartPos: 41,
|
||||
EndPos: 58,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -550,7 +549,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 43,
|
||||
StartPos: 42,
|
||||
EndPos: 58,
|
||||
},
|
||||
Value: "RuntimeException",
|
||||
@@ -562,14 +561,14 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 60,
|
||||
StartPos: 59,
|
||||
EndPos: 61,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 60,
|
||||
StartPos: 59,
|
||||
EndPos: 61,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -581,7 +580,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 67,
|
||||
StartPos: 66,
|
||||
EndPos: 107,
|
||||
},
|
||||
Types: []node.Node{
|
||||
@@ -589,7 +588,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 74,
|
||||
StartPos: 73,
|
||||
EndPos: 100,
|
||||
},
|
||||
Parts: []node.Node{
|
||||
@@ -597,7 +596,7 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 84,
|
||||
StartPos: 83,
|
||||
EndPos: 100,
|
||||
},
|
||||
Value: "AdditionException",
|
||||
@@ -609,14 +608,14 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 102,
|
||||
StartPos: 101,
|
||||
EndPos: 103,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 102,
|
||||
StartPos: 101,
|
||||
EndPos: 103,
|
||||
},
|
||||
Value: "e",
|
||||
@@ -629,12 +628,12 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -21,7 +20,7 @@ func TestUnset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -29,7 +28,7 @@ func TestUnset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 13,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -37,14 +36,14 @@ func TestUnset(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -55,12 +54,12 @@ func TestUnset(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -73,7 +72,7 @@ func TestUnsetVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -81,7 +80,7 @@ func TestUnsetVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 17,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -89,14 +88,14 @@ func TestUnsetVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -106,14 +105,14 @@ func TestUnsetVars(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -124,12 +123,12 @@ func TestUnsetVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -142,7 +141,7 @@ func TestUnsetTrailingComma(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -150,7 +149,7 @@ func TestUnsetTrailingComma(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 18,
|
||||
},
|
||||
Vars: []node.Node{
|
||||
@@ -158,14 +157,14 @@ func TestUnsetTrailingComma(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 10,
|
||||
StartPos: 9,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "a",
|
||||
@@ -175,14 +174,14 @@ func TestUnsetTrailingComma(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
VarName: &node.Identifier{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 15,
|
||||
},
|
||||
Value: "b",
|
||||
@@ -193,7 +192,7 @@ func TestUnsetTrailingComma(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -129,9 +129,10 @@ var nodesToTest = []struct {
|
||||
&stmt.Declare{
|
||||
Consts: []node.Node{&stmt.Expression{}},
|
||||
Stmt: &stmt.StmtList{},
|
||||
Alt: true,
|
||||
},
|
||||
[]string{"Consts", "Stmt"},
|
||||
nil,
|
||||
map[string]interface{}{"Alt": true},
|
||||
},
|
||||
{
|
||||
&stmt.Default{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package stmt_test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
|
||||
"gotest.tools/assert"
|
||||
@@ -22,7 +21,7 @@ func TestBreakEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -30,14 +29,14 @@ func TestBreakEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 23,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -46,7 +45,7 @@ func TestBreakEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 23,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -54,7 +53,7 @@ func TestBreakEmpty(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 21,
|
||||
},
|
||||
},
|
||||
@@ -64,12 +63,12 @@ func TestBreakEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -82,7 +81,7 @@ func TestBreakLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 25,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -90,14 +89,14 @@ func TestBreakLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 25,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -106,7 +105,7 @@ func TestBreakLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 14,
|
||||
StartPos: 13,
|
||||
EndPos: 25,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -114,14 +113,14 @@ func TestBreakLight(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 23,
|
||||
},
|
||||
Expr: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "2",
|
||||
@@ -133,12 +132,12 @@ func TestBreakLight(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
@@ -151,7 +150,7 @@ func TestBreak(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 34,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -159,14 +158,14 @@ func TestBreak(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 4,
|
||||
StartPos: 3,
|
||||
EndPos: 34,
|
||||
},
|
||||
Cond: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 11,
|
||||
StartPos: 10,
|
||||
EndPos: 11,
|
||||
},
|
||||
Value: "1",
|
||||
@@ -175,7 +174,7 @@ func TestBreak(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 24,
|
||||
},
|
||||
Stmts: []node.Node{
|
||||
@@ -183,14 +182,14 @@ func TestBreak(t *testing.T) {
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 16,
|
||||
StartPos: 15,
|
||||
EndPos: 24,
|
||||
},
|
||||
Expr: &scalar.Lnumber{
|
||||
Position: &position.Position{
|
||||
StartLine: 1,
|
||||
EndLine: 1,
|
||||
StartPos: 22,
|
||||
StartPos: 21,
|
||||
EndPos: 22,
|
||||
},
|
||||
Value: "3",
|
||||
@@ -202,12 +201,12 @@ func TestBreak(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser([]byte(src))
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser([]byte(src))
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assert.DeepEqual(t, expected, actual)
|
||||
|
||||
Reference in New Issue
Block a user