Skip to content

Commit

Permalink
language/display: change tests to prepare for CLDR 32
Browse files Browse the repository at this point in the history
Change-Id: I89e9b78227ff4db60efca2308d06fb1750844d64
Reviewed-on: https://go-review.googlesource.com/82904
Run-TryBot: Marcel van Lohuizen <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
Reviewed-by: Nigel Tao <[email protected]>
  • Loading branch information
mpvl committed Dec 14, 2017
1 parent 1516014 commit 681d1c0
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions language/display/display_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,6 @@ func TestTag(t *testing.T) {
{"sr-Latn", "sr-Latn-ME", "srpskohrvatski (Crna Gora)"},
// Double script and region
{"nl", "en-Cyrl-BE", "Engels (Cyrillisch, België)"},
// Canonical equivalents.
{"ro", "ro-MD", "moldovenească"},
{"ro", "mo", "moldovenească"},
}
for _, tt := range tests {
t.Run(tt.dict+"/"+tt.tag, func(t *testing.T) {
Expand Down Expand Up @@ -445,9 +442,6 @@ func TestLanguage(t *testing.T) {
{"en", "af-NA", "Afrikaans"},
{"en", "zu-BR", "Zulu"},
{"agq", "zh-Hant", "|[language: zh-Hant]"},
// Canonical equivalents.
{"ro", "ro-MD", "moldovenească"},
{"ro", "mo", "moldovenească"},
{"en", "sh", "Serbo-Croatian"},
{"en", "sr-Latn", "Serbo-Croatian"},
{"en", "sr", "Serbian"},
Expand Down Expand Up @@ -540,8 +534,6 @@ func TestRegion(t *testing.T) {
{"nl", "NL", "Nederland"},
{"en", "US", "United States"},
{"en", "ZZ", "Unknown Region"},
{"en", "UM", "U.S. Outlying Islands"},
{"en-GB", "UM", "U.S. Outlying Islands"},
{"en-GB", "NL", "Netherlands"},
// Canonical equivalents
{"en", "UK", "United Kingdom"},
Expand Down Expand Up @@ -628,9 +620,6 @@ func TestSelf(t *testing.T) {
{"sr-Latn-ME", "srpskohrvatski"},
{"sr-Cyrl-ME", "српски"},
{"sr-NL", "српски"},
// Canonical equivalents.
{"ro-MD", "moldovenească"},
{"mo", "moldovenească"},
// NOTE: kk is defined, but in Cyrillic script. For China, Arab is the
// dominant script. We do not have data for kk-Arab and we chose to not
// fall back in such cases.
Expand All @@ -644,6 +633,27 @@ func TestSelf(t *testing.T) {
}
}

func TestEquivalence(t *testing.T) {
testCases := []struct {
desc string
namer Namer
}{
{"Self", Self},
{"Tags", Tags(language.Romanian)},
{"Languages", Languages(language.Romanian)},
{"Scripts", Scripts(language.Romanian)},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
ro := tc.namer.Name(language.Raw.MustParse("ro-MD"))
mo := tc.namer.Name(language.Raw.MustParse("mo"))
if ro != mo {
t.Errorf("%q != %q", ro, mo)
}
})
}
}

func TestDictionaryLang(t *testing.T) {
tests := []struct {
d *Dictionary
Expand Down Expand Up @@ -693,7 +703,6 @@ func TestDictionaryScript(t *testing.T) {
name string
}{
{English, "Cyrl", "Cyrillic"},
{Portuguese, "Gujr", "gujerati"},
{EuropeanPortuguese, "Gujr", "guzerate"},
}
for i, test := range tests {
Expand Down

0 comments on commit 681d1c0

Please sign in to comment.