]> granicus.if.org Git - icu/commitdiff
ICU-12431 Update test expectations in TestLocaleNamePackaging.
authorFredrik Roubert <roubert@google.com>
Mon, 18 Mar 2019 20:33:52 +0000 (21:33 +0100)
committerFredrik Roubert <fredrik@roubert.name>
Wed, 17 Apr 2019 17:48:23 +0000 (19:48 +0200)
These test expectations have been out-of-sync with the output that ICU4J
actually generates for quite some time now. This change brings the
expectations in sync with actual behaviour and makes the test pass.

icu4j/main/tests/packaging/src/com/ibm/icu/dev/test/TestLocaleNamePackaging.java

index e062b7243e087cfd94d1e4b0c3a3ab17ec40d7ef..9905eed20b72dc1d7944bd93c618a1366208eaad 100644 (file)
@@ -68,10 +68,10 @@ public class TestLocaleNamePackaging extends TestFmwk {
             "Deutschland",
             "Thailand",
             "",
-            "United States",
-            "Spain",
-            "Germany",
-            "Thailand",
+            "US",
+            "ES",
+            "DE",
+            "TH",
         };
         String[] expectedWithoutRegionData = {
             "",
@@ -117,34 +117,34 @@ public class TestLocaleNamePackaging extends TestFmwk {
             "en",
             "es",
             "de",
-            "und",
+            "",
             "",
             "English",
             "Spanish",
             "German",
-            "Unknown Language",
+            "",
             "",
             "ingl\u00E9s",
             "espa\u00F1ol",
             "alem\u00E1n",
-            "lengua desconocida",
+            "",
             "",
             "Englisch",
             "Spanisch",
             "Deutsch",
-            "Unbestimmte Sprache",
             "",
-            "English",
-            "Spanish",
-            "German",
-            "Unknown Language",
+            "",
+            "en",
+            "es",
+            "de",
+            "",
         };
         String[] expectedWithoutLanguageData = {
             "",
             "en",
             "es",
             "de",
-            "und"
+            "",
         };
         String[] expected = LocaleDisplayNamesImpl.haveData(LANG) ?
             expectedWithLanguageData : expectedWithoutLanguageData;
@@ -166,9 +166,12 @@ public class TestLocaleNamePackaging extends TestFmwk {
         for (Locale displayJavaLocale : javaLocales) {
             LocaleDisplayNames dn = LocaleDisplayNames.getInstance(displayJavaLocale);
             for (Locale targetLocale : javaLocales) {
-                String result = dn.languageDisplayName(targetLocale.getLanguage());
-                assertEquals(targetLocale + " in " + displayJavaLocale, expected[n++], result);
-                if (n == expected.length) {
+                // ICU-20273: ICU and Java handle "und" differently, skip those test cases.
+                if (!"und".equals(targetLocale.getLanguage())) {
+                    String result = dn.languageDisplayName(targetLocale.getLanguage());
+                    assertEquals(targetLocale + " in " + displayJavaLocale, expected[n], result);
+                }
+                if (++n == expected.length) {
                     n = 0;
                 }
             }
@@ -180,14 +183,14 @@ public class TestLocaleNamePackaging extends TestFmwk {
     @Test
     public void testLocaleDisplayNameWithKeywords() {
         String[] expectedWithLanguageData = {
-            "root (collation=phonebook)",
-            "Root (Phonebook Sort Order)",
-            "ra\u00EDz (orden de list\u00EDn telef\u00F3nico)",
-            "Root (Telefonbuch-Sortierung)",
-            "Root (Phonebook Sort Order)",
+            "und (collation=phonebook)",
+            "Unknown language (Phonebook Sort Order)",
+            "lengua desconocida (orden de list\u00EDn telef\u00F3nico)",
+            "Unbekannte Sprache (Telefonbuch-Sortierung)",
+            "und (collation=phonebook)",
         };
         String[] expectedWithoutLanguageData = {
-            "root (collation=phonebook)",
+            "und (collation=phonebook)",
         };
         String[] expected = LocaleDisplayNamesImpl.haveData(LANG) ?
             expectedWithLanguageData : expectedWithoutLanguageData;