-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathterritory_test.go
41 lines (38 loc) · 1.32 KB
/
territory_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
package i18n
import (
"testing"
)
func TestTerritories(t *testing.T) {
var tests = []struct {
code string
found bool
expectedEnglishName string
expectedNativeName string
}{
/* 0 */ {"XY", false, "", ""},
/* 1 */ {"DE", true, "Germany", "Deutschland"},
// BUG(oe): Wrong native name, at least from a German standpoint ;-)
/* 2 */ {"CH", true, "Switzerland", "Svizra"},
// BUG(oe): Wrong native name, at least from a German standpoint ;-)
/* 3 */ {"GB", true, "United Kingdom", "y Deyrnas Unedig"},
/* 4 */ {"US", true, "United States", "United States"},
/* 5 */ {"CN", true, "People's Republic of China", "ཀྲུང་ཧྭ་མི་དམངས་སྤྱི་མཐུན་རྒྱལ་ཁབ།"},
}
for i, f := range tests {
c, found := Territories[f.code]
if found != f.found {
t.Fatalf("%d. expected territory %s found flag to be %v, got %v", i, f.code, f.found, found)
}
if f.found {
if c == nil {
t.Fatalf("%d. expected country to be != nil", i)
}
if f.expectedEnglishName != c.EnglishName {
t.Errorf("%d. expected EnglishName to be %v, got %v", i, f.expectedEnglishName, c.EnglishName)
}
if f.expectedNativeName != c.NativeName {
t.Errorf("%d. expected NativeName to be %v, got %v", i, f.expectedNativeName, c.NativeName)
}
}
}
}