Merge pull request #9 from z7zmey/issue-8
Issue #8 - Calling parser concurrently
This commit is contained in:
commit
219bb36c69
17
README.md
17
README.md
@ -31,6 +31,7 @@ go get github.com/z7zmey/php-parser
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
"os"
|
||||
|
||||
@ -40,17 +41,23 @@ import (
|
||||
|
||||
func main() {
|
||||
src := bytes.NewBufferString(`<? echo "Hello world";`)
|
||||
nodes, comments, positions, errors := php7.Parse(src, "example.php")
|
||||
|
||||
_ = errors
|
||||
parser := php7.NewParser(src, "example.php")
|
||||
parser.Parse()
|
||||
|
||||
for _, e := range parser.GetErrors() {
|
||||
fmt.Println(e)
|
||||
}
|
||||
|
||||
visitor := visitor.Dumper{
|
||||
Writer: os.Stdout,
|
||||
Indent: "",
|
||||
Comments: comments,
|
||||
Positions: positions,
|
||||
Comments: parser.GetComments(),
|
||||
Positions: parser.GetPositions(),
|
||||
}
|
||||
nodes.Walk(visitor)
|
||||
|
||||
rootNode := parser.GetRootNode()
|
||||
rootNode.Walk(visitor)
|
||||
}
|
||||
```
|
||||
|
||||
|
20
doc.go
20
doc.go
@ -7,6 +7,7 @@ Features:
|
||||
* Fully support PHP5 and PHP7 syntax
|
||||
* Abstract syntax tree representation
|
||||
* Traversing AST
|
||||
* Namespace resolver
|
||||
|
||||
Install:
|
||||
|
||||
@ -21,7 +22,9 @@ Package usage example:
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
"os"
|
||||
|
||||
"github.com/z7zmey/php-parser/php7"
|
||||
"github.com/z7zmey/php-parser/visitor"
|
||||
@ -29,14 +32,23 @@ Package usage example:
|
||||
|
||||
func main() {
|
||||
src := bytes.NewBufferString(`<? echo "Hello world";`)
|
||||
nodes, comments, positions := php7.Parse(src, "example.php")
|
||||
|
||||
parser := php7.NewParser(src, "example.php")
|
||||
parser.Parse()
|
||||
|
||||
for _, e := range parser.GetErrors() {
|
||||
fmt.Println(e)
|
||||
}
|
||||
|
||||
visitor := visitor.Dumper{
|
||||
Writer: os.Stdout,
|
||||
Indent: "",
|
||||
Comments: comments,
|
||||
Positions: positions,
|
||||
Comments: parser.GetComments(),
|
||||
Positions: parser.GetPositions(),
|
||||
}
|
||||
nodes.Walk(visitor)
|
||||
|
||||
rootNode := parser.GetRootNode()
|
||||
rootNode.Walk(visitor)
|
||||
}
|
||||
*/
|
||||
package main // import "github.com/z7zmey/php-parser"
|
||||
|
106
main.go
106
main.go
@ -6,56 +6,50 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
|
||||
"github.com/yookoala/realpath"
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/php5"
|
||||
"github.com/z7zmey/php-parser/php7"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/visitor"
|
||||
)
|
||||
|
||||
func main() {
|
||||
var nodes node.Node
|
||||
var comments comment.Comments
|
||||
var positions position.Positions
|
||||
var errors []*errors.Error
|
||||
var wg sync.WaitGroup
|
||||
var usePhp5 *bool
|
||||
|
||||
usePhp5 := flag.Bool("php5", false, "use PHP5 parser")
|
||||
func main() {
|
||||
usePhp5 = flag.Bool("php5", false, "use PHP5 parser")
|
||||
flag.Parse()
|
||||
|
||||
for _, path := range flag.Args() {
|
||||
pathCh := make(chan string)
|
||||
resultCh := make(chan Parser)
|
||||
|
||||
// run 4 concurrent parsers
|
||||
for i := 0; i < 4; i++ {
|
||||
go parser(pathCh, resultCh)
|
||||
}
|
||||
|
||||
// run printer goroutine
|
||||
go printer(resultCh)
|
||||
|
||||
// process files
|
||||
processPath(flag.Args(), pathCh)
|
||||
|
||||
// wait the all files done
|
||||
wg.Wait()
|
||||
close(pathCh)
|
||||
close(resultCh)
|
||||
}
|
||||
|
||||
func processPath(pathList []string, pathCh chan<- string) {
|
||||
for _, path := range pathList {
|
||||
real, err := realpath.Realpath(path)
|
||||
checkErr(err)
|
||||
|
||||
err = filepath.Walk(real, func(path string, f os.FileInfo, err error) error {
|
||||
if !f.IsDir() && filepath.Ext(path) == ".php" {
|
||||
fmt.Printf("==> %s\n", path)
|
||||
|
||||
src, _ := os.Open(string(path))
|
||||
if *usePhp5 {
|
||||
nodes, comments, positions, errors = php5.Parse(src, path)
|
||||
} else {
|
||||
nodes, comments, positions, errors = php7.Parse(src, path)
|
||||
}
|
||||
|
||||
for _, e := range errors {
|
||||
fmt.Println(e)
|
||||
}
|
||||
|
||||
nsResolver := visitor.NewNamespaceResolver()
|
||||
nodes.Walk(nsResolver)
|
||||
|
||||
dumper := visitor.Dumper{
|
||||
Writer: os.Stdout,
|
||||
Indent: " | ",
|
||||
Comments: comments,
|
||||
Positions: positions,
|
||||
NsResolver: nsResolver,
|
||||
}
|
||||
nodes.Walk(dumper)
|
||||
wg.Add(1)
|
||||
pathCh <- path
|
||||
}
|
||||
return nil
|
||||
})
|
||||
@ -63,6 +57,48 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func parser(pathCh <-chan string, result chan<- Parser) {
|
||||
var parser Parser
|
||||
|
||||
for {
|
||||
path := <-pathCh
|
||||
src, _ := os.Open(path)
|
||||
|
||||
if *usePhp5 {
|
||||
parser = php5.NewParser(src, path)
|
||||
} else {
|
||||
parser = php7.NewParser(src, path)
|
||||
}
|
||||
|
||||
parser.Parse()
|
||||
result <- parser
|
||||
}
|
||||
}
|
||||
|
||||
func printer(result <-chan Parser) {
|
||||
for {
|
||||
parser := <-result
|
||||
fmt.Printf("==> %s\n", parser.GetPath())
|
||||
|
||||
for _, e := range parser.GetErrors() {
|
||||
fmt.Println(e)
|
||||
}
|
||||
|
||||
nsResolver := visitor.NewNamespaceResolver()
|
||||
parser.GetRootNode().Walk(nsResolver)
|
||||
|
||||
dumper := visitor.Dumper{
|
||||
Writer: os.Stdout,
|
||||
Indent: " | ",
|
||||
Comments: parser.GetComments(),
|
||||
Positions: parser.GetPositions(),
|
||||
NsResolver: nsResolver,
|
||||
}
|
||||
parser.GetRootNode().Walk(dumper)
|
||||
wg.Done()
|
||||
}
|
||||
}
|
||||
|
||||
func checkErr(err error) {
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
@ -43,10 +43,14 @@ func TestReference(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -70,10 +74,14 @@ func TestReferenceNew(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -104,10 +112,14 @@ func TestReferenceArgs(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -125,10 +137,14 @@ func TestAssign(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -146,10 +162,14 @@ func TestBitwiseAnd(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -167,10 +187,14 @@ func TestBitwiseOr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -188,10 +212,14 @@ func TestBitwiseXor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -209,10 +237,14 @@ func TestConcat(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -230,10 +262,14 @@ func TestDiv(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -251,10 +287,14 @@ func TestMinus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -272,10 +312,14 @@ func TestMod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -293,10 +337,14 @@ func TestMul(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -314,10 +362,14 @@ func TestPlus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -335,10 +387,14 @@ func TestPow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -356,10 +412,14 @@ func TestShiftLeft(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -377,9 +437,13 @@ func TestShiftRight(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -41,10 +41,14 @@ func TestBitwiseAnd(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -62,10 +66,14 @@ func TestBitwiseOr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -83,10 +91,14 @@ func TestBitwiseXor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -104,10 +116,14 @@ func TestBooleanAnd(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -125,10 +141,14 @@ func TestBooleanOr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -146,7 +166,9 @@ func TestCoalesce(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -164,10 +186,14 @@ func TestConcat(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -185,10 +211,14 @@ func TestDiv(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -206,10 +236,14 @@ func TestEqual(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -227,10 +261,14 @@ func TestGreaterOrEqual(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -248,10 +286,14 @@ func TestGreater(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -269,10 +311,14 @@ func TestIdentical(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -290,10 +336,14 @@ func TestLogicalAnd(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -311,10 +361,14 @@ func TestLogicalOr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -332,10 +386,14 @@ func TestLogicalXor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -353,10 +411,14 @@ func TestMinus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -374,10 +436,14 @@ func TestMod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -395,10 +461,14 @@ func TestMul(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -416,10 +486,14 @@ func TestNotEqual(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -437,10 +511,14 @@ func TestNotIdentical(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -458,10 +536,14 @@ func TestPlus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -479,10 +561,14 @@ func TestPow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -500,10 +586,14 @@ func TestShiftLeft(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -521,10 +611,14 @@ func TestShiftRight(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -542,10 +636,14 @@ func TestSmallerOrEqual(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -563,10 +661,14 @@ func TestSmaller(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -584,6 +686,8 @@ func TestSpaceship(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -40,10 +40,14 @@ func TestArray(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -60,10 +64,14 @@ func TestBool(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -80,10 +88,14 @@ func TestBoolShort(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -100,10 +112,14 @@ func TestDouble(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -120,10 +136,14 @@ func TestCastFloat(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -140,10 +160,14 @@ func TestInt(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -160,10 +184,14 @@ func TestIntShort(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -180,10 +208,14 @@ func TestObject(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -200,10 +232,14 @@ func TestString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -220,9 +256,13 @@ func TestUnset(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -42,10 +42,14 @@ func TestArrayDimFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -66,9 +70,13 @@ func TestArrayDimFetchNested(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,10 +27,14 @@ func TestArray(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -52,10 +56,14 @@ func TestArrayItem(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -82,9 +90,13 @@ func TestArrayItems(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ func TestBitwiseNot(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ func TestBooleanNot(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -32,10 +32,14 @@ func TestClassConstFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -53,9 +57,13 @@ func TestStaticClassConstFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ func TestCloneBrackets(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -45,9 +49,13 @@ func TestClone(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -31,10 +31,14 @@ func TestClosure(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -76,10 +80,14 @@ func TestClosureUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -121,10 +129,14 @@ func TestClosureUse2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -148,6 +160,8 @@ func TestClosureReturnType(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,10 +27,14 @@ func TestConstFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -47,10 +51,14 @@ func TestConstFetchRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -67,9 +75,13 @@ func TestConstFetchFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ func TestEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ func TestErrorSuppress(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ func TestEval(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -23,10 +23,14 @@ func TestExit(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -43,10 +47,14 @@ func TestExitExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -61,10 +69,14 @@ func TestDie(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -81,9 +93,13 @@ func TestDieExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -35,10 +35,14 @@ func TestFunctionCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -60,10 +64,14 @@ func TestFunctionCallRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -93,10 +101,14 @@ func TestFunctionFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -122,10 +134,14 @@ func TestFunctionCallVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -156,9 +172,13 @@ func TestFunctionCallExprArg(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ func TestPostDec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -45,10 +49,14 @@ func TestPostInc(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -65,10 +73,14 @@ func TestPreDec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -85,9 +97,13 @@ func TestPreInc(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ func TestInclude(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -45,10 +49,14 @@ func TestIncludeOnce(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -65,10 +73,14 @@ func TestRequire(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -85,9 +97,13 @@ func TestRequireOnce(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -32,10 +32,14 @@ func TestInstanceOf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -57,10 +61,14 @@ func TestInstanceOfRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -82,9 +90,13 @@ func TestInstanceOfFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,10 +27,14 @@ func TestIsset(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -50,9 +54,13 @@ func TestIssetVariables(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -30,10 +30,14 @@ func TestEmptyList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -58,10 +62,14 @@ func TestList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -88,10 +96,14 @@ func TestListArrayIndex(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -123,9 +135,13 @@ func TestListList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,9 +27,13 @@ func TestMethodCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -31,10 +31,14 @@ func TestNew(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -56,10 +60,14 @@ func TestNewRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -81,10 +89,14 @@ func TestNewFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -108,6 +120,8 @@ func TestNewAnonymous(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,9 +25,13 @@ func TestPrint(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -26,9 +26,13 @@ func TestPropertyFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -30,9 +30,13 @@ func TestShellExec(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,10 +27,14 @@ func TestShortArray(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -52,10 +56,14 @@ func TestShortArrayItem(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -82,9 +90,13 @@ func TestShortArrayItems(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -34,7 +34,9 @@ func TestShortList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -61,7 +63,9 @@ func TestShortListArrayIndex(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -93,6 +97,8 @@ func TestShortListList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -33,10 +33,14 @@ func TestStaticCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -59,10 +63,14 @@ func TestStaticCallRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -85,10 +93,14 @@ func TestStaticCallFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -111,10 +123,14 @@ func TestStaticCallVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -133,9 +149,13 @@ func TestStaticCallVarVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -31,10 +31,14 @@ func TestStaticPropertyFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -56,10 +60,14 @@ func TestStaticPropertyFetchRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -81,9 +89,13 @@ func TestStaticPropertyFetchFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,10 +27,14 @@ func TestTernary(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -48,10 +52,14 @@ func TestTernarySimple(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -74,10 +82,14 @@ func TestTernaryNestedTrue(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -100,9 +112,13 @@ func TestTernaryNestedCond(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ func TestUnaryMinus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -45,9 +49,13 @@ func TestUnaryPlus(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -23,10 +23,14 @@ func TestVariable(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -41,9 +45,13 @@ func TestVariableVariable(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ func TestYield(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -44,10 +48,14 @@ func TestYieldVal(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -65,10 +73,14 @@ func TestYieldKeyVal(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -85,10 +97,14 @@ func TestYieldExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -106,10 +122,14 @@ func TestYieldKeyExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -126,6 +146,8 @@ func TestYieldFrom(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -44,10 +44,14 @@ func TestName(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -67,10 +71,14 @@ func TestFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -90,10 +98,14 @@ func TestRelative(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,14 @@ func TestSimpleVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -52,10 +56,14 @@ func TestSimpleVarOneChar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -76,10 +84,14 @@ func TestSimpleVarEndsEcapsed(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -100,10 +112,14 @@ func TestStringVarCurveOpen(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -127,10 +143,14 @@ func TestSimpleVarPropertyFetch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -150,10 +170,14 @@ func TestDollarOpenCurlyBraces(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -176,10 +200,14 @@ func TestDollarOpenCurlyBracesDimNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -203,9 +231,13 @@ func TestCurlyOpenMethodCall(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -34,10 +34,14 @@ LBL;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -62,10 +66,14 @@ LBL;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -88,10 +96,14 @@ LBL;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -110,10 +122,14 @@ CAD;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -136,9 +152,13 @@ CAD;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -23,9 +23,13 @@ func TestMagicConstant(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -37,10 +37,14 @@ func TestLNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -55,10 +59,14 @@ func TestDNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -73,10 +81,14 @@ func TestFloat(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -91,10 +103,14 @@ func TestBinaryLNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -109,10 +125,14 @@ func TestBinaryDNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -127,10 +147,14 @@ func TestHLNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -145,9 +169,13 @@ func TestHDNumber(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -22,10 +22,14 @@ func TestDoubleQuotedScalarString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
func TestDoubleQuotedScalarStringWithEscapedVar(t *testing.T) {
|
||||
@ -39,10 +43,14 @@ func TestDoubleQuotedScalarStringWithEscapedVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -59,10 +67,14 @@ func TestMultilineDoubleQuotedScalarString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -77,10 +89,14 @@ func TestSingleQuotedScalarString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -97,9 +113,13 @@ func TestMultilineSingleQuotedScalarString(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -42,10 +42,14 @@ func TestAltIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -71,10 +75,14 @@ func TestAltElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -97,10 +105,14 @@ func TestAltElse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -135,9 +147,13 @@ func TestAltElseElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -42,7 +42,9 @@ func TestClassConstList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -73,9 +75,13 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -29,10 +29,14 @@ func TestSimpleClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -68,10 +72,14 @@ func TestPrivateProtectedClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -98,7 +106,9 @@ func TestPhp5ClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -130,7 +140,9 @@ func TestPhp7ClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -157,10 +169,14 @@ func TestAbstractClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -191,6 +207,8 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ func TestSimpleClass(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -46,10 +50,14 @@ func TestAbstractClass(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -73,10 +81,14 @@ func TestClassExtends(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -102,10 +114,14 @@ func TestClassImplement(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -136,10 +152,14 @@ func TestClassImplements(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -176,6 +196,8 @@ func TestAnonimousClass(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -34,9 +34,13 @@ func TestConstList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -28,10 +28,14 @@ func TestContinueEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -53,10 +57,14 @@ func TestContinueLight(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -78,9 +86,13 @@ func TestContinue(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -30,10 +30,14 @@ func TestDeclare(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -62,10 +66,14 @@ func TestDeclareStmts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -89,9 +97,13 @@ func TestAltDeclare(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -26,9 +26,13 @@ func TestDo(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -30,10 +30,14 @@ func TestSimpleEcho(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -52,9 +56,13 @@ func TestEcho(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -23,9 +23,13 @@ func TestExpression(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -48,10 +48,14 @@ func TestFor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -77,9 +81,13 @@ func TestAltFor(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ func TestForeach(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -45,10 +49,14 @@ func TestForeachExpr(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -65,10 +73,14 @@ func TestAltForeach(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -86,10 +98,14 @@ func TestForeachWithKey(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -107,10 +123,14 @@ func TestForeachExprWithKey(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -129,10 +149,14 @@ func TestForeachWithRef(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -158,9 +182,13 @@ func TestForeachWithList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -28,10 +28,14 @@ func TestSimpleFunction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -51,10 +55,14 @@ func TestFunctionReturn(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -90,10 +98,14 @@ func TestFunctionReturnVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -115,10 +127,14 @@ func TestRefFunction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -141,6 +157,8 @@ func TestReturnTypeFunction(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -25,10 +25,14 @@ func TestGlobal(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -57,9 +61,13 @@ func TestGlobalVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -24,9 +24,13 @@ func TestGotoLabel(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -19,9 +19,13 @@ func TestHaltCompiler(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ func TestIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -50,10 +54,14 @@ func TestElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -72,10 +80,14 @@ func TestElse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -104,10 +116,14 @@ func TestElseElseIf(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -138,9 +154,13 @@ func TestElseIfElseIfElse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -20,9 +20,13 @@ func TestInlineHtml(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ func TestInterface(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -51,10 +55,14 @@ func TestInterfaceExtend(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -83,9 +91,13 @@ func TestInterfaceExtends(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -26,10 +26,14 @@ func TestNamespace(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -49,10 +53,14 @@ func TestNamespaceStmts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -67,9 +75,13 @@ func TestAnonymousNamespace(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -36,10 +36,14 @@ func TestProperty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -73,10 +77,14 @@ func TestProperties(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -110,9 +118,13 @@ func TestProperties2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -27,10 +27,14 @@ func TestStaticVar(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -53,10 +57,14 @@ func TestStaticVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -79,9 +87,13 @@ func TestStaticVars2(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -42,10 +42,14 @@ func TestAltSwitch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -75,10 +79,14 @@ func TestAltSwitchSemicolon(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -112,10 +120,14 @@ func TestSwitch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -149,9 +161,13 @@ func TestSwitchSemicolon(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -22,9 +22,13 @@ func TestThrow(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -23,9 +23,13 @@ func TestTrait(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -34,10 +34,14 @@ func TestTraitUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -69,10 +73,14 @@ func TestTraitsUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -104,10 +112,14 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -147,10 +159,14 @@ func TestTraitsUseModifier(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -191,10 +207,14 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -261,9 +281,13 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -26,10 +26,14 @@ func TestTry(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -61,10 +65,14 @@ func TestTryCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -101,7 +109,9 @@ func TestPhp7TryCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -146,10 +156,14 @@ func TestTryCatchCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -184,10 +198,14 @@ func TestTryCatchFinally(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -243,9 +261,13 @@ func TestTryCatchCatchCatch(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -24,10 +24,14 @@ func TestUnset(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -45,10 +49,14 @@ func TestUnsetVars(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -66,6 +74,8 @@ func TestUnsetTrailingComma(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -30,10 +30,14 @@ func TestSimpleUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -56,10 +60,14 @@ func TestUseFullyQualified(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -83,10 +91,14 @@ func TestUseFullyQualifiedAlias(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -116,10 +128,14 @@ func TestUseList(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -150,10 +166,14 @@ func TestUseListAlias(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -184,10 +204,14 @@ func TestUseListFunctionType(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -220,10 +244,14 @@ func TestUseListFunctionTypeAliases(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -254,10 +282,14 @@ func TestUseListConstType(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -290,10 +322,14 @@ func TestUseListConstTypeAliases(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -328,7 +364,9 @@ func TestGroupUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -364,7 +402,9 @@ func TestGroupUseAlias(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -400,7 +440,9 @@ func TestFunctionGroupUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -436,7 +478,9 @@ func TestConstGroupUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -473,6 +517,8 @@ func TestMixedGroupUse(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -28,10 +28,14 @@ func TestBreakEmpty(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -53,10 +57,14 @@ func TestBreakLight(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -78,9 +86,13 @@ func TestBreak(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -42,10 +42,14 @@ func TestIdentifier(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -135,7 +139,9 @@ func TestPhp7ArgumentNode(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -211,7 +217,9 @@ func TestPhp5ArgumentNode(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -277,7 +285,9 @@ func TestPhp7ParameterNode(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -343,7 +353,9 @@ func TestPhp5ParameterNode(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -354,9 +366,13 @@ func TestCommentEndFile(t *testing.T) {
|
||||
Stmts: []node.Node{},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
|
||||
actual, _, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual = php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
17
parser.go
Normal file
17
parser.go
Normal file
@ -0,0 +1,17 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
)
|
||||
|
||||
type Parser interface {
|
||||
Parse() int
|
||||
GetPath() string
|
||||
GetRootNode() node.Node
|
||||
GetErrors() []*errors.Error
|
||||
GetComments() comment.Comments
|
||||
GetPositions() position.Positions
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package php5
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
goToken "go/token"
|
||||
"io"
|
||||
|
||||
"github.com/cznic/golex/lex"
|
||||
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/scanner"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
type lexer struct {
|
||||
scanner.Lexer
|
||||
lastToken *token.Token
|
||||
errors []*errors.Error
|
||||
}
|
||||
|
||||
func (l *lexer) Lex(lval *yySymType) int {
|
||||
t := l.Lexer.Lex(lval)
|
||||
l.lastToken = &lval.token
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func (l *lexer) Error(msg string) {
|
||||
l.errors = append(l.errors, errors.NewError(msg, *l.lastToken))
|
||||
}
|
||||
|
||||
func (lval *yySymType) Token(t token.Token) {
|
||||
lval.token = t
|
||||
}
|
||||
|
||||
func newLexer(src io.Reader, fName string) *lexer {
|
||||
file := goToken.NewFileSet().AddFile(fName, -1, 1<<31-1)
|
||||
lx, err := lex.New(file, bufio.NewReader(src), lex.RuneClass(scanner.Rune2Class))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
scanner := scanner.Lexer{
|
||||
Lexer: lx,
|
||||
StateStack: []int{0},
|
||||
PhpDocComment: "",
|
||||
Comments: nil,
|
||||
}
|
||||
|
||||
return &lexer{
|
||||
scanner,
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
}
|
121
php5/parser.go
121
php5/parser.go
@ -1,72 +1,109 @@
|
||||
// Package php5 parses PHP5
|
||||
package php5
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/node/expr"
|
||||
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/stmt"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/scanner"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
var rootnode node.Node
|
||||
var comments comment.Comments
|
||||
var positions position.Positions
|
||||
var positionBuilder position.Builder
|
||||
|
||||
var parentNode node.Node
|
||||
|
||||
// Parse the php5 parser entrypoint
|
||||
func Parse(src io.Reader, fName string) (node.Node, comment.Comments, position.Positions, []*errors.Error) {
|
||||
yyDebug = 0
|
||||
yyErrorVerbose = true
|
||||
rootnode = stmt.NewStmtList([]node.Node{}) //reset
|
||||
comments = comment.Comments{}
|
||||
positions = position.Positions{}
|
||||
positionBuilder = position.Builder{Positions: &positions}
|
||||
|
||||
lexer := newLexer(src, fName)
|
||||
yyParse(lexer)
|
||||
return rootnode, comments, positions, lexer.errors
|
||||
func (lval *yySymType) Token(t token.Token) {
|
||||
lval.token = t
|
||||
}
|
||||
|
||||
// ListGetFirstNodeComments returns comments of a first node in the list
|
||||
func ListGetFirstNodeComments(list []node.Node) []comment.Comment {
|
||||
// Parser structure
|
||||
type Parser struct {
|
||||
*scanner.Lexer
|
||||
path string
|
||||
lastToken *token.Token
|
||||
positionBuilder *position.Builder
|
||||
errors []*errors.Error
|
||||
rootNode node.Node
|
||||
comments comment.Comments
|
||||
positions position.Positions
|
||||
}
|
||||
|
||||
// NewParser creates and returns new Parser
|
||||
func NewParser(src io.Reader, path string) *Parser {
|
||||
lexer := scanner.NewLexer(src, path)
|
||||
|
||||
return &Parser{
|
||||
lexer,
|
||||
path,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Lex proxy to lexer Lex
|
||||
func (l *Parser) Lex(lval *yySymType) int {
|
||||
t := l.Lexer.Lex(lval)
|
||||
l.lastToken = &lval.token
|
||||
return t
|
||||
}
|
||||
|
||||
func (l *Parser) Error(msg string) {
|
||||
l.errors = append(l.errors, errors.NewError(msg, *l.lastToken))
|
||||
}
|
||||
|
||||
// Parse the php7 Parser entrypoint
|
||||
func (l *Parser) Parse() int {
|
||||
yyDebug = 0
|
||||
yyErrorVerbose = true
|
||||
|
||||
// init
|
||||
l.errors = nil
|
||||
l.rootNode = nil
|
||||
l.comments = comment.Comments{}
|
||||
l.positions = position.Positions{}
|
||||
l.positionBuilder = &position.Builder{
|
||||
Positions: &l.positions,
|
||||
}
|
||||
|
||||
// parse
|
||||
|
||||
return yyParse(l)
|
||||
}
|
||||
|
||||
func (l *Parser) listGetFirstNodeComments(list []node.Node) []comment.Comment {
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
node := list[0]
|
||||
|
||||
return comments[node]
|
||||
return l.comments[node]
|
||||
}
|
||||
|
||||
type foreachVariable struct {
|
||||
node node.Node
|
||||
byRef bool
|
||||
// GetPath return path to file
|
||||
func (l *Parser) GetPath() string {
|
||||
return l.path
|
||||
}
|
||||
|
||||
type nodesWithEndToken struct {
|
||||
nodes []node.Node
|
||||
endToken token.Token
|
||||
// GetRootNode returns root node
|
||||
func (l *Parser) GetRootNode() node.Node {
|
||||
return l.rootNode
|
||||
}
|
||||
|
||||
type boolWithToken struct {
|
||||
value bool
|
||||
token *token.Token
|
||||
// GetErrors returns errors list
|
||||
func (l *Parser) GetErrors() []*errors.Error {
|
||||
return l.errors
|
||||
}
|
||||
|
||||
type simpleIndirectReference struct {
|
||||
all []*expr.Variable
|
||||
last *expr.Variable
|
||||
// GetComments returns comments list
|
||||
func (l *Parser) GetComments() comment.Comments {
|
||||
return l.comments
|
||||
}
|
||||
|
||||
type altSyntaxNode struct {
|
||||
node node.Node
|
||||
isAlt bool
|
||||
// GetPositions returns positions list
|
||||
func (l *Parser) GetPositions() position.Positions {
|
||||
return l.positions
|
||||
}
|
||||
|
2852
php5/php5.go
2852
php5/php5.go
File diff suppressed because it is too large
Load Diff
1814
php5/php5.y
1814
php5/php5.y
File diff suppressed because it is too large
Load Diff
@ -414,6 +414,7 @@ CAD;
|
||||
`
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
}
|
||||
}
|
||||
|
@ -3615,7 +3615,9 @@ func TestPhp5(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -3652,7 +3654,9 @@ func TestPhp5Strings(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -3718,6 +3722,8 @@ CAD;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php5parser := php5.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php5parser.Parse()
|
||||
actual := php5parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -1,55 +0,0 @@
|
||||
package php7
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
goToken "go/token"
|
||||
"io"
|
||||
|
||||
"github.com/cznic/golex/lex"
|
||||
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/scanner"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
type lexer struct {
|
||||
scanner.Lexer
|
||||
lastToken *token.Token
|
||||
errors []*errors.Error
|
||||
}
|
||||
|
||||
func (l *lexer) Lex(lval *yySymType) int {
|
||||
t := l.Lexer.Lex(lval)
|
||||
l.lastToken = &lval.token
|
||||
|
||||
return t
|
||||
}
|
||||
|
||||
func (l *lexer) Error(msg string) {
|
||||
l.errors = append(l.errors, errors.NewError(msg, *l.lastToken))
|
||||
}
|
||||
|
||||
func (lval *yySymType) Token(t token.Token) {
|
||||
lval.token = t
|
||||
}
|
||||
|
||||
func newLexer(src io.Reader, fName string) *lexer {
|
||||
file := goToken.NewFileSet().AddFile(fName, -1, 1<<31-1)
|
||||
lx, err := lex.New(file, bufio.NewReader(src), lex.RuneClass(scanner.Rune2Class))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
scanner := scanner.Lexer{
|
||||
Lexer: lx,
|
||||
StateStack: []int{0},
|
||||
PhpDocComment: "",
|
||||
Comments: nil,
|
||||
}
|
||||
|
||||
return &lexer{
|
||||
scanner,
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
}
|
114
php7/parser.go
114
php7/parser.go
@ -1,4 +1,3 @@
|
||||
// Package php7 parses PHP7
|
||||
package php7
|
||||
|
||||
import (
|
||||
@ -7,57 +6,104 @@ import (
|
||||
"github.com/z7zmey/php-parser/comment"
|
||||
"github.com/z7zmey/php-parser/errors"
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
"github.com/z7zmey/php-parser/node/stmt"
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
"github.com/z7zmey/php-parser/scanner"
|
||||
"github.com/z7zmey/php-parser/token"
|
||||
)
|
||||
|
||||
var rootnode node.Node
|
||||
var comments comment.Comments
|
||||
var positions position.Positions
|
||||
var positionBuilder position.Builder
|
||||
|
||||
// Parse the php7 parser entrypoint
|
||||
func Parse(src io.Reader, fName string) (node.Node, comment.Comments, position.Positions, []*errors.Error) {
|
||||
yyDebug = 0
|
||||
yyErrorVerbose = true
|
||||
rootnode = stmt.NewStmtList([]node.Node{}) //reset
|
||||
comments = comment.Comments{}
|
||||
positions = position.Positions{}
|
||||
positionBuilder = position.Builder{&positions}
|
||||
|
||||
lexer := newLexer(src, fName)
|
||||
yyParse(lexer)
|
||||
return rootnode, comments, positions, lexer.errors
|
||||
func (lval *yySymType) Token(t token.Token) {
|
||||
lval.token = t
|
||||
}
|
||||
|
||||
// ListGetFirstNodeComments returns comments of a first node in the list
|
||||
func ListGetFirstNodeComments(list []node.Node) []comment.Comment {
|
||||
// Parser structure
|
||||
type Parser struct {
|
||||
*scanner.Lexer
|
||||
path string
|
||||
lastToken *token.Token
|
||||
positionBuilder *position.Builder
|
||||
errors []*errors.Error
|
||||
rootNode node.Node
|
||||
comments comment.Comments
|
||||
positions position.Positions
|
||||
}
|
||||
|
||||
// NewParser creates and returns new Parser
|
||||
func NewParser(src io.Reader, path string) *Parser {
|
||||
lexer := scanner.NewLexer(src, path)
|
||||
|
||||
return &Parser{
|
||||
lexer,
|
||||
path,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
nil,
|
||||
}
|
||||
}
|
||||
|
||||
// Lex proxy to lexer Lex
|
||||
func (l *Parser) Lex(lval *yySymType) int {
|
||||
t := l.Lexer.Lex(lval)
|
||||
l.lastToken = &lval.token
|
||||
return t
|
||||
}
|
||||
|
||||
func (l *Parser) Error(msg string) {
|
||||
l.errors = append(l.errors, errors.NewError(msg, *l.lastToken))
|
||||
}
|
||||
|
||||
// Parse the php7 Parser entrypoint
|
||||
func (l *Parser) Parse() int {
|
||||
yyDebug = 0
|
||||
yyErrorVerbose = true
|
||||
|
||||
// init
|
||||
l.errors = nil
|
||||
l.rootNode = nil
|
||||
l.comments = comment.Comments{}
|
||||
l.positions = position.Positions{}
|
||||
l.positionBuilder = &position.Builder{
|
||||
Positions: &l.positions,
|
||||
}
|
||||
|
||||
// parse
|
||||
|
||||
return yyParse(l)
|
||||
}
|
||||
|
||||
func (l *Parser) listGetFirstNodeComments(list []node.Node) []comment.Comment {
|
||||
if len(list) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
node := list[0]
|
||||
|
||||
return comments[node]
|
||||
return l.comments[node]
|
||||
}
|
||||
|
||||
type foreachVariable struct {
|
||||
node node.Node
|
||||
byRef bool
|
||||
// GetPath return path to file
|
||||
func (l *Parser) GetPath() string {
|
||||
return l.path
|
||||
}
|
||||
|
||||
type nodesWithEndToken struct {
|
||||
nodes []node.Node
|
||||
endToken token.Token
|
||||
// GetRootNode returns root node
|
||||
func (l *Parser) GetRootNode() node.Node {
|
||||
return l.rootNode
|
||||
}
|
||||
|
||||
type boolWithToken struct {
|
||||
value bool
|
||||
token *token.Token
|
||||
// GetErrors returns errors list
|
||||
func (l *Parser) GetErrors() []*errors.Error {
|
||||
return l.errors
|
||||
}
|
||||
|
||||
type altSyntaxNode struct {
|
||||
node node.Node
|
||||
isAlt bool
|
||||
// GetComments returns comments list
|
||||
func (l *Parser) GetComments() comment.Comments {
|
||||
return l.comments
|
||||
}
|
||||
|
||||
// GetPositions returns positions list
|
||||
func (l *Parser) GetPositions() position.Positions {
|
||||
return l.positions
|
||||
}
|
||||
|
1272
php7/php7.go
1272
php7/php7.go
File diff suppressed because it is too large
Load Diff
1270
php7/php7.y
1270
php7/php7.y
File diff suppressed because it is too large
Load Diff
@ -382,6 +382,7 @@ CAD;
|
||||
`
|
||||
|
||||
for n := 0; n < b.N; n++ {
|
||||
php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
}
|
||||
}
|
||||
|
@ -3166,7 +3166,9 @@ func TestPhp7(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -3203,7 +3205,9 @@ func TestPhp5Strings(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
||||
@ -3269,6 +3273,8 @@ CAD;
|
||||
},
|
||||
}
|
||||
|
||||
actual, _, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
actual := php7parser.GetRootNode()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ func ExampleDumper() {
|
||||
}
|
||||
}`
|
||||
|
||||
nodes, comments, positions, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||
php7parser := php7.NewParser(bytes.NewBufferString(src), "test.php")
|
||||
php7parser.Parse()
|
||||
nodes := php7parser.GetRootNode()
|
||||
|
||||
nsResolver := visitor.NewNamespaceResolver()
|
||||
nodes.Walk(nsResolver)
|
||||
@ -30,8 +32,8 @@ func ExampleDumper() {
|
||||
dumper := visitor.Dumper{
|
||||
Writer: os.Stdout,
|
||||
Indent: "| ",
|
||||
Comments: comments,
|
||||
Positions: positions,
|
||||
Comments: php7parser.GetComments(),
|
||||
Positions: php7parser.GetPositions(),
|
||||
NsResolver: nsResolver,
|
||||
}
|
||||
nodes.Walk(dumper)
|
||||
|
Loading…
Reference in New Issue
Block a user