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