update tests
This commit is contained in:
30
node/name/t_meta_test.go
Normal file
30
node/name/t_meta_test.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package name_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/z7zmey/php-parser/node/name"
|
||||
|
||||
"github.com/z7zmey/php-parser/meta"
|
||||
|
||||
"github.com/z7zmey/php-parser/node"
|
||||
)
|
||||
|
||||
var nodes = []node.Node{
|
||||
&name.FullyQualified{},
|
||||
&name.NamePart{},
|
||||
&name.Name{},
|
||||
&name.Relative{},
|
||||
}
|
||||
|
||||
func TestMeta(t *testing.T) {
|
||||
expected := []meta.Meta{
|
||||
meta.NewComment("//comment\n", nil),
|
||||
meta.NewWhiteSpace(" ", nil),
|
||||
}
|
||||
for _, n := range nodes {
|
||||
n.AddMeta(expected)
|
||||
actual := n.GetMeta()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
16
node/name/t_position_test.go
Normal file
16
node/name/t_position_test.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package name_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/z7zmey/php-parser/position"
|
||||
)
|
||||
|
||||
func TestPosition(t *testing.T) {
|
||||
expected := position.NewPosition(1, 1, 1, 1)
|
||||
for _, n := range nodes {
|
||||
n.SetPosition(expected)
|
||||
actual := n.GetPosition()
|
||||
assertEqual(t, expected, actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user