summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Chang <vichang@google.com>2023-07-03 09:58:04 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-07-03 09:58:04 +0000
commitf85c36308950a0244f491502dd163966f32fae86 (patch)
tree9a1f3a499b6232db6168dabb99ce3ec00b6cfc7a
parente6e1c31736efe241a9bf48167202d8605560c64a (diff)
parent47426506d66d85f743f8e7be485082e811fbf0ef (diff)
downloadicu-f85c36308950a0244f491502dd163966f32fae86.tar.gz
Android patch: Skip cintltst.tsutil.cloctst.TestISOFunction am: 2c9c564a5b am: 47426506d6
Original change: https://android-review.googlesource.com/c/platform/external/icu/+/2645440 Change-Id: I8c5f113404da4bd2de6749b9a15f47b1720217a3 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 c8bfce680..a822d87b4 100644
--- a/icu4c/source/test/cintltst/cloctst.c
+++ b/icu4c/source/test/cintltst/cloctst.c
@@ -1321,6 +1321,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.";
+}