summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-03 23:05:57 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-03 23:05:57 +0000
commitf6669a10c198d7017a3a567a09f8f6c1d93700d8 (patch)
treea7ad300f7332ff3d36250fb3c15d553e1d675376
parent5bccce5e52277f777c3c6875a6e32c466f3b9180 (diff)
parent8617c5914704f59ee05515132fad09f1c9b03f70 (diff)
downloadicu-f6669a10c198d7017a3a567a09f8f6c1d93700d8.tar.gz
Snap for 10430480 from 8617c5914704f59ee05515132fad09f1c9b03f70 to udc-d1-release
Change-Id: I40a0894087215a7715471ba861e9df392049a40f
-rw-r--r--icu4c/source/test/cintltst/cloctst.c5
-rw-r--r--libicu/test/src/uloc_test.cpp25
2 files changed, 29 insertions, 1 deletions
diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c
index 6ba368a62..87ed3ced4 100644
--- a/icu4c/source/test/cintltst/cloctst.c
+++ b/icu4c/source/test/cintltst/cloctst.c
@@ -1322,6 +1322,11 @@ static void TestIllegalArgumentWhenNoDataWithNoSubstitute()
/* test for uloc_getISOLanguages, uloc_getISOCountries */
static void TestISOFunctions()
{
+ // Android-changed: Skip this test on Android because we allow extra languages added on devices.
+ if (true) {
+ return;
+ }
+
const char* const* str=uloc_getISOLanguages();
const char* const* str1=uloc_getISOCountries();
const char* test;
diff --git a/libicu/test/src/uloc_test.cpp b/libicu/test/src/uloc_test.cpp
index 15632cd50..8b08b4930 100644
--- a/libicu/test/src/uloc_test.cpp
+++ b/libicu/test/src/uloc_test.cpp
@@ -16,6 +16,7 @@
#include <gtest/gtest.h>
+#include <unordered_set>
#include <vector>
#include <unicode/uloc.h>
@@ -42,4 +43,26 @@ TEST(Icu4cLocaleTest, test_uloc_getCountry) {
uloc_getCountry("en_US", country, sizeof(country), &error);
ASSERT_EQ(U_ZERO_ERROR, error);
EXPECT_STREQ("US", country);
-} \ No newline at end of file
+}
+
+TEST(Icu4cLocaleTest, test_uloc_getISOLanguages) {
+ std::unordered_set<std::string> languages;
+ const char* const* list_ptr = uloc_getISOLanguages();
+ while(*list_ptr != 0) {
+ languages.insert(*list_ptr);
+ list_ptr++;
+ }
+
+ EXPECT_TRUE(languages.find("en") != languages.end()) << "language en must be supported.";
+}
+
+TEST(Icu4cLocaleTest, test_uloc_getISOCountries) {
+ std::unordered_set<std::string> countries;
+ const char* const* list_ptr = uloc_getISOCountries();
+ while(*list_ptr != 0) {
+ countries.insert(*list_ptr);
+ list_ptr++;
+ }
+
+ EXPECT_TRUE(countries.find("US") != countries.end()) << "country US must be supported.";
+}