-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontributor_test.go
60 lines (48 loc) · 1.12 KB
/
contributor_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
49
50
51
52
53
54
55
56
57
58
59
60
package vcsview
import (
"testing"
)
func TestContributor_Name(t *testing.T) {
cases := []string{
"",
"testing name",
}
for key, testCase := range cases {
c := Contributor{}
c.name = testCase
if name := c.Name(); name != testCase {
t.Errorf("[%d] Contributor.Name() = %v, want: %v", key, name, testCase)
}
}
}
func TestContributor_Email(t *testing.T) {
cases := []string{
"",
"test@email.ltd",
}
for key, testCase := range cases {
c := Contributor{}
c.email = testCase
if email := c.Email(); email != testCase {
t.Errorf("[%d] Contributor.Email() = %v, want: %v", key, email, testCase)
}
}
}
func TestContributor_String(t *testing.T) {
cases := []struct{
name string
email string
want string
}{
{"", "", ""},
{"", "email@email.ltd", " <email@email.ltd>"},
{"test", "", "test"},
{"test", "email@email.ltd", "test <email@email.ltd>"},
}
for key, testCase := range cases {
c := Contributor{testCase.name, testCase.email}
if contributor := c.String(); contributor != testCase.want {
t.Errorf("[%d] Contributor.String() = %v, want: %v", key, contributor, testCase.want)
}
}
}