php-parser/node/expr/assign/t_meta_test.go

50 lines
869 B
Go
Raw Normal View History

2018-06-30 21:05:59 +00:00
package assign_test
import (
"testing"
"github.com/z7zmey/php-parser/node/expr/assign"
"github.com/z7zmey/php-parser/meta"
"github.com/z7zmey/php-parser/node"
)
var nodes = []node.Node{
&assign.Reference{},
&assign.Assign{},
&assign.BitwiseAnd{},
&assign.BitwiseOr{},
&assign.BitwiseXor{},
&assign.Concat{},
&assign.Div{},
&assign.Minus{},
&assign.Mod{},
&assign.Mul{},
&assign.Plus{},
&assign.Pow{},
&assign.ShiftLeft{},
&assign.ShiftRight{},
&assign.ShiftRight{},
}
func TestMeta(t *testing.T) {
expected := &meta.Collection{
&meta.Data{
Value: "//comment\n",
Type: meta.CommentType,
Position: nil,
},
&meta.Data{
Value: " ",
Type: meta.WhiteSpaceType,
Position: nil,
},
2018-06-30 21:05:59 +00:00
}
for _, n := range nodes {
n.GetMeta().Push(*expected...)
2018-06-30 21:05:59 +00:00
actual := n.GetMeta()
assertEqual(t, expected, actual)
}
}