-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjob_test.go
More file actions
40 lines (35 loc) · 771 Bytes
/
job_test.go
File metadata and controls
40 lines (35 loc) · 771 Bytes
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
package testbot
import "testing"
func TestParseJob(t *testing.T) {
cases := []struct {
s string
j Job
}{
{"91ac/meta", Job{"91ac", "/", "meta"}},
{"91ac/core/gotest", Job{"91ac", "/core", "gotest"}},
{"91ac/cmd/ledgerd/gotest", Job{"91ac", "/cmd/ledgerd", "gotest"}},
}
for _, test := range cases {
j, err := ParseJob(test.s)
if err != nil {
t.Errorf("ParseJob(%q) err = %v, want nil", test.s, err)
}
if j != test.j {
t.Errorf("ParseJob(%q) = %+v, want %+v", test.s, j, test.j)
}
}
}
func TestParseJobBad(t *testing.T) {
cases := []string{
"91ac",
"91ac/",
"91ac/meta/",
"foo/meta",
}
for _, test := range cases {
_, err := ParseJob(test)
if err == nil {
t.Errorf("ParseJob(%q) err = nil, want error", test)
}
}
}