php-parser/comment/comment_test.go
2018-04-15 15:55:33 +03:00

28 lines
600 B
Go

package comment_test
import (
"testing"
"github.com/z7zmey/php-parser/comment"
"github.com/z7zmey/php-parser/node"
)
func TestComments(t *testing.T) {
n := node.NewIdentifier("test")
commentGroup := []*comment.Comment{
comment.NewComment("/** hello world */"),
comment.NewComment("// hello world"),
}
comments := comment.Comments{}
comments.AddComments(n, commentGroup)
if comments[n][0].String() != "/** hello world */" {
t.Errorf("expected and actual are not equal\n")
}
if comments[n][1].String() != "// hello world" {
t.Errorf("expected and actual are not equal\n")
}
}