2018-01-12 23:58:59 +00:00
|
|
|
package comment_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-04-15 18:39:26 +00:00
|
|
|
"github.com/z7zmey/php-parser/position"
|
|
|
|
|
2018-01-12 23:58:59 +00:00
|
|
|
"github.com/z7zmey/php-parser/comment"
|
|
|
|
)
|
|
|
|
|
2018-04-15 19:02:07 +00:00
|
|
|
func TestCommentGetPosition(t *testing.T) {
|
|
|
|
expected := position.NewPosition(0, 0, 0, 0)
|
2018-01-12 23:58:59 +00:00
|
|
|
|
2018-04-15 19:02:07 +00:00
|
|
|
comment := comment.NewComment("/** hello world */", expected)
|
2018-01-12 23:58:59 +00:00
|
|
|
|
2018-04-15 19:02:07 +00:00
|
|
|
actual := comment.Position()
|
2018-01-12 23:58:59 +00:00
|
|
|
|
2018-04-15 19:02:07 +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-04-15 19:02:07 +00:00
|
|
|
func TestCommentPrint(t *testing.T) {
|
|
|
|
expected := "/** hello world */"
|
2018-04-15 18:39:26 +00:00
|
|
|
|
2018-04-15 19:02:07 +00:00
|
|
|
comment := comment.NewComment(expected, nil)
|
2018-04-15 18:39:26 +00:00
|
|
|
|
2018-04-15 19:02:07 +00:00
|
|
|
actual := comment.String()
|
2018-04-15 18:39:26 +00:00
|
|
|
|
|
|
|
if expected != actual {
|
|
|
|
t.Errorf("expected and actual are not equal\n")
|
|
|
|
}
|
|
|
|
}
|