forked from lyft/protoc-gen-star
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comment_test.go
48 lines (42 loc) · 989 Bytes
/
comment_test.go
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package pgs
import (
"strconv"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestC(t *testing.T) {
t.Parallel()
tests := []struct {
in []interface{}
ex string
}{
{
[]interface{}{"foo", " bar", " baz"},
"// foo bar baz\n",
},
{
in: []interface{}{"the quick brown fox jumps over the lazy dog"},
ex: "// the quick brown\n// fox jumps over\n// the lazy dog\n",
},
{
in: []interface{}{"supercalifragilisticexpialidocious"},
ex: "// supercalifragilisticexpialidocious\n",
},
{
in: []interface{}{"1234567890123456789012345 foo"},
ex: "// 1234567890123456789012345\n// foo\n",
},
}
for i, test := range tests {
tc := test
t.Run(strconv.Itoa(i), func(t *testing.T) {
assert.Equal(t, tc.ex, C(20, tc.in...))
})
}
}
func TestC80(t *testing.T) {
t.Parallel()
ex := "// foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo foo\n// foo\n"
assert.Equal(t, ex, C80(strings.Repeat("foo ", 20)))
}