php-parser/comment/comment_test.go

32 lines
576 B
Go
Raw Normal View History

2018-01-12 23:58:59 +00:00
package comment_test
import (
"testing"
"github.com/z7zmey/php-parser/comment"
)
2018-06-25 12:38:31 +00:00
func TestCommentPrint(t *testing.T) {
expected := "/** hello world */"
2018-01-12 23:58:59 +00:00
2018-06-25 12:38:31 +00:00
comment := comment.NewComment(expected, nil)
2018-01-12 23:58:59 +00:00
2018-06-25 12:38:31 +00:00
actual := comment.String()
2018-01-12 23:58:59 +00:00
if expected != actual {
2018-01-12 23:58:59 +00:00
t.Errorf("expected and actual are not equal\n")
}
}
2018-04-15 18:39:26 +00:00
2018-06-25 12:38:31 +00:00
func TestCommentSetTokenName(t *testing.T) {
expected := comment.ArrayToken
c := comment.NewComment("/** hello world */", nil)
c.SetTokenName(expected)
2018-04-15 18:39:26 +00:00
2018-06-25 12:38:31 +00:00
actual := c.TokenName
2018-04-15 18:39:26 +00:00
if expected != actual {
t.Errorf("expected and actual are not equal\n")
}
}