summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2023-07-03 09:58:36 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-07-03 09:58:36 +0000
commit59b4387d0d53abdba5a36c920b935370babf93bd (patch)
treea7ad300f7332ff3d36250fb3c15d553e1d675376
parent3ba7a3c5bd7a819ab73fccafdcc240763b7c0696 (diff)
parentdaff518ecd514fed0d686d4ace7dcc1cc949779a (diff)
downloadicu-59b4387d0d53abdba5a36c920b935370babf93bd.tar.gz
Android patch: Skip cintltst.tsutil.cloctst.TestISOFunction am: 2c9c564a5b am: daff518ecd
Original change: https://android-review.googlesource.com/c/platform/external/icu/+/2645440 Change-Id: I09faf2f3d5440b12e4c550205299fbd70b405c28 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-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.";
+}