File: comment_test.go

package info (click to toggle)
golang-gitea-noerw-unidiff-comments 0.0~git20220822.50f4daa%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 336 kB
  • sloc: makefile: 4
file content (26 lines) | stat: -rw-r--r-- 453 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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)
		}
	}
}