add comment tests
This commit is contained in:
parent
289f4d0767
commit
86c162920a
27
comment/comment_test.go
Normal file
27
comment/comment_test.go
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
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.NewDocComment("/** hello world */"),
|
||||||
|
comment.NewPlainComment("// 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")
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user