...
1
2
3
4
5 package cldr
6
7 import "testing"
8
9 func TestParseDraft(t *testing.T) {
10 tests := []struct {
11 in string
12 draft Draft
13 err bool
14 }{
15 {"unconfirmed", Unconfirmed, false},
16 {"provisional", Provisional, false},
17 {"contributed", Contributed, false},
18 {"approved", Approved, false},
19 {"", Approved, false},
20 {"foo", Approved, true},
21 }
22 for _, tt := range tests {
23 if d, err := ParseDraft(tt.in); d != tt.draft || (err != nil) != tt.err {
24 t.Errorf("%q: was %v, %v; want %v, %v", tt.in, d, err != nil, tt.draft, tt.err)
25 }
26 }
27 }
28
View as plain text