unidiff-comments/types/comment_test.go
Norwin 71ca77c7f9
restructure package
so parser-only usage has no dependencies
2020-12-19 09:50:07 +01:00

27 lines
453 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package types
import "testing"
func TestShortComment(t *testing.T) {
tests := []struct {
comment Comment
short string
}{
{
Comment{Text: "Привет!\n Как дела? Нормально?"},
"Привет! Как дела? Но...",
},
{
Comment{Text: "fixed"},
"fixed",
},
}
for _, test := range tests {
actual := test.comment.Short(20)
if actual != test.short {
t.Fatalf("unexpected %#v", actual)
}
}
}