fix Makefile, run gofmt on the all go files
This commit is contained in:
parent
757f57c223
commit
014b0576d6
2
Makefile
2
Makefile
@ -3,7 +3,7 @@ PHPFILE=example.php
|
|||||||
all: compile run
|
all: compile run
|
||||||
|
|
||||||
build:
|
build:
|
||||||
gofmt -l -s -w **/*.go
|
find . -type f -iregex '.*\.go' -exec gofmt -l -s -w '{}' +
|
||||||
go build
|
go build
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
|
@ -57,7 +57,7 @@ func TestAssignRefNew(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &assign_op.AssignRef{
|
Expr: &assign_op.AssignRef{
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
||||||
Expression: &expr.New{
|
Expression: &expr.New{
|
||||||
Class: &name.Name{
|
Class: &name.Name{
|
||||||
Parts: []node.Node{
|
Parts: []node.Node{
|
||||||
@ -84,7 +84,7 @@ func TestAssignRefArgs(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &assign_op.AssignRef{
|
Expr: &assign_op.AssignRef{
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
||||||
Expression: &expr.New{
|
Expression: &expr.New{
|
||||||
Class: &name.Name{
|
Class: &name.Name{
|
||||||
Parts: []node.Node{
|
Parts: []node.Node{
|
||||||
@ -93,9 +93,9 @@ func TestAssignRefArgs(t *testing.T) {
|
|||||||
},
|
},
|
||||||
Arguments: []node.Node{
|
Arguments: []node.Node{
|
||||||
&node.Argument{
|
&node.Argument{
|
||||||
Variadic: false,
|
Variadic: false,
|
||||||
IsReference: false,
|
IsReference: false,
|
||||||
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
|
Expr: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
"github.com/kylelemons/godebug/pretty"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/expr/cast"
|
"github.com/z7zmey/php-parser/node/expr/cast"
|
||||||
|
@ -3,9 +3,9 @@ package cast_test
|
|||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kylelemons/godebug/pretty"
|
"github.com/kylelemons/godebug/pretty"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/expr/cast"
|
"github.com/z7zmey/php-parser/node/expr/cast"
|
||||||
|
@ -46,7 +46,7 @@ func TestStaticClassConstFetch(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Expression{
|
&stmt.Expression{
|
||||||
Expr: &expr.ClassConstFetch{
|
Expr: &expr.ClassConstFetch{
|
||||||
Class: &node.Identifier{Value: "static"},
|
Class: &node.Identifier{Value: "static"},
|
||||||
ConstantName: &node.Identifier{Value: "bar"},
|
ConstantName: &node.Identifier{Value: "bar"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -122,8 +122,8 @@ func TestCurlyOpenMethodCall(t *testing.T) {
|
|||||||
Parts: []node.Node{
|
Parts: []node.Node{
|
||||||
&scalar.EncapsedStringPart{Value: "test "},
|
&scalar.EncapsedStringPart{Value: "test "},
|
||||||
&expr.MethodCall{
|
&expr.MethodCall{
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$foo"}},
|
||||||
Method: &node.Identifier{Value: "bar"},
|
Method: &node.Identifier{Value: "bar"},
|
||||||
Arguments: []node.Node{},
|
Arguments: []node.Node{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
|
|
||||||
// While node
|
// While node
|
||||||
type While struct {
|
type While struct {
|
||||||
Cond node.Node
|
Cond node.Node
|
||||||
Stmt node.Node
|
Stmt node.Node
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWhile node constuctor
|
// NewWhile node constuctor
|
||||||
|
@ -45,7 +45,6 @@ func TestAltIf(t *testing.T) {
|
|||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
|
|
||||||
|
|
||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
@ -75,7 +74,6 @@ func TestAltElseIf(t *testing.T) {
|
|||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
|
|
||||||
|
|
||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
@ -102,7 +100,6 @@ func TestAltElse(t *testing.T) {
|
|||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
|
|
||||||
|
|
||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
@ -141,7 +138,6 @@ func TestAltElseElseIf(t *testing.T) {
|
|||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
|
|
||||||
|
|
||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
@ -27,13 +27,13 @@ func TestClassConstList(t *testing.T) {
|
|||||||
Consts: []node.Node{
|
Consts: []node.Node{
|
||||||
&stmt.Constant{
|
&stmt.Constant{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ConstantName: &node.Identifier{Value: "FOO"},
|
ConstantName: &node.Identifier{Value: "FOO"},
|
||||||
Expr: &scalar.Lnumber{Value: "1"},
|
Expr: &scalar.Lnumber{Value: "1"},
|
||||||
},
|
},
|
||||||
&stmt.Constant{
|
&stmt.Constant{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ConstantName: &node.Identifier{Value: "BAR"},
|
ConstantName: &node.Identifier{Value: "BAR"},
|
||||||
Expr: &scalar.Lnumber{Value: "2"},
|
Expr: &scalar.Lnumber{Value: "2"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -58,13 +58,13 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
|||||||
Consts: []node.Node{
|
Consts: []node.Node{
|
||||||
&stmt.Constant{
|
&stmt.Constant{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ConstantName: &node.Identifier{Value: "FOO"},
|
ConstantName: &node.Identifier{Value: "FOO"},
|
||||||
Expr: &scalar.Lnumber{Value: "1"},
|
Expr: &scalar.Lnumber{Value: "1"},
|
||||||
},
|
},
|
||||||
&stmt.Constant{
|
&stmt.Constant{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ConstantName: &node.Identifier{Value: "BAR"},
|
ConstantName: &node.Identifier{Value: "BAR"},
|
||||||
Expr: &scalar.Lnumber{Value: "2"},
|
Expr: &scalar.Lnumber{Value: "2"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -76,7 +76,6 @@ func TestClassConstListWithoutModifiers(t *testing.T) {
|
|||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
|
|
||||||
|
|
||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -21,8 +21,8 @@ func TestSimpleClassMethod(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.ClassMethod{
|
&stmt.ClassMethod{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
MethodName: &node.Identifier{Value: "bar"},
|
MethodName: &node.Identifier{Value: "bar"},
|
||||||
Stmts: []node.Node{},
|
Stmts: []node.Node{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -85,8 +85,8 @@ func TestPhp5ClassMethod(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.ClassMethod{
|
&stmt.ClassMethod{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ReturnsRef: true,
|
ReturnsRef: true,
|
||||||
MethodName: &node.Identifier{Value: "bar"},
|
MethodName: &node.Identifier{Value: "bar"},
|
||||||
Modifiers: []node.Node{
|
Modifiers: []node.Node{
|
||||||
&node.Identifier{Value: "public"},
|
&node.Identifier{Value: "public"},
|
||||||
&node.Identifier{Value: "static"},
|
&node.Identifier{Value: "static"},
|
||||||
@ -112,8 +112,8 @@ func TestPhp7ClassMethod(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.ClassMethod{
|
&stmt.ClassMethod{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ReturnsRef: true,
|
ReturnsRef: true,
|
||||||
MethodName: &node.Identifier{Value: "bar"},
|
MethodName: &node.Identifier{Value: "bar"},
|
||||||
Modifiers: []node.Node{
|
Modifiers: []node.Node{
|
||||||
&node.Identifier{Value: "public"},
|
&node.Identifier{Value: "public"},
|
||||||
&node.Identifier{Value: "static"},
|
&node.Identifier{Value: "static"},
|
||||||
@ -145,8 +145,8 @@ func TestAbstractClassMethod(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.ClassMethod{
|
&stmt.ClassMethod{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ReturnsRef: false,
|
ReturnsRef: false,
|
||||||
MethodName: &node.Identifier{Value: "bar"},
|
MethodName: &node.Identifier{Value: "bar"},
|
||||||
Modifiers: []node.Node{
|
Modifiers: []node.Node{
|
||||||
&node.Identifier{Value: "abstract"},
|
&node.Identifier{Value: "abstract"},
|
||||||
&node.Identifier{Value: "public"},
|
&node.Identifier{Value: "public"},
|
||||||
@ -175,8 +175,8 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.ClassMethod{
|
&stmt.ClassMethod{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ReturnsRef: false,
|
ReturnsRef: false,
|
||||||
MethodName: &node.Identifier{Value: "bar"},
|
MethodName: &node.Identifier{Value: "bar"},
|
||||||
Modifiers: []node.Node{
|
Modifiers: []node.Node{
|
||||||
&node.Identifier{Value: "public"},
|
&node.Identifier{Value: "public"},
|
||||||
},
|
},
|
||||||
@ -193,4 +193,4 @@ func TestPhp7AbstractClassMethod(t *testing.T) {
|
|||||||
|
|
||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"bytes"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -19,7 +19,7 @@ func TestSimpleClass(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
ClassName: &node.Identifier{Value: "foo"},
|
ClassName: &node.Identifier{Value: "foo"},
|
||||||
Stmts: []node.Node{},
|
Stmts: []node.Node{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
|
|
||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -20,7 +19,7 @@ func TestInterface(t *testing.T) {
|
|||||||
&stmt.Interface{
|
&stmt.Interface{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
InterfaceName: &node.Identifier{Value: "Foo"},
|
InterfaceName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{},
|
Stmts: []node.Node{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -56,7 +56,6 @@ func TestNamespaceStmts(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestAnonymousNamespace(t *testing.T) {
|
func TestAnonymousNamespace(t *testing.T) {
|
||||||
src := `<? namespace {}`
|
src := `<? namespace {}`
|
||||||
|
|
||||||
@ -73,4 +72,4 @@ func TestAnonymousNamespace(t *testing.T) {
|
|||||||
|
|
||||||
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ = php5.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/node/scalar"
|
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
|
"github.com/z7zmey/php-parser/node/scalar"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -27,7 +27,7 @@ func TestProperty(t *testing.T) {
|
|||||||
Properties: []node.Node{
|
Properties: []node.Node{
|
||||||
&stmt.Property{
|
&stmt.Property{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -59,12 +59,12 @@ func TestProperties(t *testing.T) {
|
|||||||
Properties: []node.Node{
|
Properties: []node.Node{
|
||||||
&stmt.Property{
|
&stmt.Property{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
||||||
},
|
},
|
||||||
&stmt.Property{
|
&stmt.Property{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
|
||||||
Expr: &scalar.Lnumber{Value: "1"},
|
Expr: &scalar.Lnumber{Value: "1"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -96,12 +96,12 @@ func TestProperties2(t *testing.T) {
|
|||||||
Properties: []node.Node{
|
Properties: []node.Node{
|
||||||
&stmt.Property{
|
&stmt.Property{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$a"}},
|
||||||
Expr: &scalar.Lnumber{Value: "1"},
|
Expr: &scalar.Lnumber{Value: "1"},
|
||||||
},
|
},
|
||||||
&stmt.Property{
|
&stmt.Property{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
|
Variable: &expr.Variable{VarName: &node.Identifier{Value: "$b"}},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@ package stmt_test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/stmt"
|
"github.com/z7zmey/php-parser/node/stmt"
|
||||||
|
@ -3,7 +3,7 @@ package stmt_test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/stmt"
|
"github.com/z7zmey/php-parser/node/stmt"
|
||||||
"github.com/z7zmey/php-parser/php5"
|
"github.com/z7zmey/php-parser/php5"
|
||||||
@ -17,8 +17,8 @@ func TestTrait(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Trait{
|
&stmt.Trait{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
TraitName: &node.Identifier{Value: "Foo"},
|
TraitName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{},
|
Stmts: []node.Node{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/stmt"
|
"github.com/z7zmey/php-parser/node/stmt"
|
||||||
"github.com/z7zmey/php-parser/php5"
|
"github.com/z7zmey/php-parser/php5"
|
||||||
@ -18,7 +18,7 @@ func TestTraitUse(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ClassName: &node.Identifier{Value: "Foo"},
|
ClassName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.TraitUse{
|
&stmt.TraitUse{
|
||||||
Traits: []node.Node{
|
Traits: []node.Node{
|
||||||
@ -48,7 +48,7 @@ func TestTraitsUse(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ClassName: &node.Identifier{Value: "Foo"},
|
ClassName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.TraitUse{
|
&stmt.TraitUse{
|
||||||
Traits: []node.Node{
|
Traits: []node.Node{
|
||||||
@ -83,7 +83,7 @@ func TestTraitsUseEmptyAdaptations(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ClassName: &node.Identifier{Value: "Foo"},
|
ClassName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.TraitUse{
|
&stmt.TraitUse{
|
||||||
Traits: []node.Node{
|
Traits: []node.Node{
|
||||||
@ -118,7 +118,7 @@ func TestTraitsUseModifier(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ClassName: &node.Identifier{Value: "Foo"},
|
ClassName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.TraitUse{
|
&stmt.TraitUse{
|
||||||
Traits: []node.Node{
|
Traits: []node.Node{
|
||||||
@ -161,7 +161,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ClassName: &node.Identifier{Value: "Foo"},
|
ClassName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.TraitUse{
|
&stmt.TraitUse{
|
||||||
Traits: []node.Node{
|
Traits: []node.Node{
|
||||||
@ -182,7 +182,7 @@ func TestTraitsUseAliasModifier(t *testing.T) {
|
|||||||
Method: &node.Identifier{Value: "one"},
|
Method: &node.Identifier{Value: "one"},
|
||||||
},
|
},
|
||||||
Modifier: &node.Identifier{Value: "public"},
|
Modifier: &node.Identifier{Value: "public"},
|
||||||
Alias: &node.Identifier{Value: "two"},
|
Alias: &node.Identifier{Value: "two"},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -205,7 +205,7 @@ func TestTraitsUseAdaptions(t *testing.T) {
|
|||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Class{
|
&stmt.Class{
|
||||||
PhpDocComment: "",
|
PhpDocComment: "",
|
||||||
ClassName: &node.Identifier{Value: "Foo"},
|
ClassName: &node.Identifier{Value: "Foo"},
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.TraitUse{
|
&stmt.TraitUse{
|
||||||
Traits: []node.Node{
|
Traits: []node.Node{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"bytes"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -20,7 +20,7 @@ func TestTry(t *testing.T) {
|
|||||||
expected := &stmt.StmtList{
|
expected := &stmt.StmtList{
|
||||||
Stmts: []node.Node{
|
Stmts: []node.Node{
|
||||||
&stmt.Try{
|
&stmt.Try{
|
||||||
Stmts: []node.Node{},
|
Stmts: []node.Node{},
|
||||||
Catches: []node.Node{},
|
Catches: []node.Node{},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3,7 +3,7 @@ package stmt_test
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
"github.com/z7zmey/php-parser/node/expr"
|
"github.com/z7zmey/php-parser/node/expr"
|
||||||
"github.com/z7zmey/php-parser/node/stmt"
|
"github.com/z7zmey/php-parser/node/stmt"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package stmt_test
|
package stmt_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/z7zmey/php-parser/node/name"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"github.com/z7zmey/php-parser/node/name"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/z7zmey/php-parser/node"
|
"github.com/z7zmey/php-parser/node"
|
||||||
@ -297,7 +297,6 @@ func TestUseListConstTypeAliases(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestGroupUse(t *testing.T) {
|
func TestGroupUse(t *testing.T) {
|
||||||
src := `<? use Foo\{Bar, Baz};`
|
src := `<? use Foo\{Bar, Baz};`
|
||||||
|
|
||||||
@ -441,7 +440,6 @@ func TestConstGroupUse(t *testing.T) {
|
|||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func TestMixedGroupUse(t *testing.T) {
|
func TestMixedGroupUse(t *testing.T) {
|
||||||
src := `<? use Foo\{const Bar, function Baz};`
|
src := `<? use Foo\{const Bar, function Baz};`
|
||||||
|
|
||||||
@ -477,4 +475,4 @@ func TestMixedGroupUse(t *testing.T) {
|
|||||||
|
|
||||||
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
actual, _, _ := php7.Parse(bytes.NewBufferString(src), "test.php")
|
||||||
assertEqual(t, expected, actual)
|
assertEqual(t, expected, actual)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user