49 lines
855 B
Go
49 lines
855 B
Go
package name_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/assert"
|
|
|
|
"github.com/z7zmey/php-parser/freefloating"
|
|
"github.com/z7zmey/php-parser/node"
|
|
"github.com/z7zmey/php-parser/node/name"
|
|
)
|
|
|
|
var expected freefloating.Collection = freefloating.Collection{
|
|
freefloating.Start: []freefloating.String{
|
|
{
|
|
StringType: freefloating.WhiteSpaceType,
|
|
Value: " ",
|
|
Position: nil,
|
|
},
|
|
{
|
|
StringType: freefloating.CommentType,
|
|
Value: "//comment\n",
|
|
Position: nil,
|
|
},
|
|
},
|
|
}
|
|
|
|
var nodes = []node.Node{
|
|
&name.FullyQualified{
|
|
FreeFloating: expected,
|
|
},
|
|
&name.NamePart{
|
|
FreeFloating: expected,
|
|
},
|
|
&name.Name{
|
|
FreeFloating: expected,
|
|
},
|
|
&name.Relative{
|
|
FreeFloating: expected,
|
|
},
|
|
}
|
|
|
|
func TestMeta(t *testing.T) {
|
|
for _, n := range nodes {
|
|
actual := *n.GetFreeFloating()
|
|
assert.DeepEqual(t, expected, actual)
|
|
}
|
|
}
|