-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathticket_test.go
More file actions
39 lines (36 loc) · 787 Bytes
/
Copy pathticket_test.go
File metadata and controls
39 lines (36 loc) · 787 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
package main
import "testing"
func TestFormatTicket1(t *testing.T) {
cases := []struct {
in string
out string
}{
{"", ""},
{"ABC-123", "[ABC-123]"},
{"abc-123,def-456", "[ABC-123] [DEF-456]"},
{" xyz-1 , foo-2 ", "[XYZ-1] [FOO-2]"},
}
for _, c := range cases {
got := formatTicket1(c.in)
if got != c.out {
t.Errorf("formatTicket1(%q) = %q; want %q", c.in, got, c.out)
}
}
}
func TestFormatTicket2(t *testing.T) {
cases := []struct {
in string
out string
}{
{"", ""},
{"ABC-123", "- ABC-123"},
{"abc-123,def-456", "- ABC-123\n- DEF-456"},
{" xyz-1 , foo-2 ", "- XYZ-1\n- FOO-2"},
}
for _, c := range cases {
got := formatTicket2(c.in)
if got != c.out {
t.Errorf("formatTicket2(%q) = %q; want %q", c.in, got, c.out)
}
}
}