Skip to content

Commit

Permalink
ICU-22365 add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankYFTang committed Jul 29, 2023
1 parent c70c814 commit e88b57d
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions icu4c/source/test/cintltst/ulocbuildertst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1688,37 +1688,29 @@ static void TestSetLocale() {
ulocbld_close(bld2);
}

/*

static void TestPosixCases() {
UErrorCode status = U_ZERO_ERROR;
Locale l1 = Locale::forLanguageTag("en-US-u-va-posix", status);
if (U_FAILURE(status) || l1.isBogus()) {
errln("build got Error: %s\n", u_errorName(status));
}
LocaleBuilder bld;
bld.setLanguage("en")
.setRegion("MX")
.setScript("Arab")
.setUnicodeLocaleKeyword("nu", "Thai")
.setExtension('x', "1");
ULocaleBuilder* bld = ulocbld_open();
ulocbld_setLanguage(bld, "en", -1);
ulocbld_setRegion(bld, "MX", -1);
ulocbld_setScript(bld, "Arab", -1);
ulocbld_setUnicodeLocaleKeyword(bld, "nu", -1, "Thai", -1);
ulocbld_setExtension(bld, 'x', "1", -1);
// All of above should be cleared by the setLocale call.
Locale l2 = bld.setLocale(l1).build(status);
if (U_FAILURE(status) || l2.isBogus()) {
errln("build got Error: %s\n", u_errorName(status));
}
if (l1 != l2) {
errln("The result locale should be the set as the setLocale %s but got %s\n",
l1.toLanguageTag<std::string>(status).c_str(),
l2.toLanguageTag<std::string>(status).c_str());
const char* posix = "en_US_POSIX";
ulocbld_setLocale(bld, posix, -1);
char locale[ULOC_FULLNAME_CAPACITY];
ulocbld_buildLocaleID(bld, locale, ULOC_FULLNAME_CAPACITY, &status);
if (U_FAILURE(status)) {
log_err("build got Error: %s\n", u_errorName(status));
}
Locale posix("en-US-POSIX");
if (posix != l2) {
errln("The result locale should be the set as %s but got %s\n",
posix.getName(), l2.getName());
if (strcmp(posix, locale) != 0) {
log_err("The result locale should be the set as the setLocale %s but got %s\n",
posix, locale);
}
ulocbld_close(bld);
}
*/

#define TESTCASE(name) addTest(root, &name, "tsutil/ulocbuildertst/" #name)
void addLocaleBuilderTest(TestNode** root)
Expand Down Expand Up @@ -1757,7 +1749,5 @@ void addLocaleBuilderTest(TestNode** root)
TESTCASE(TestSetExtensionValidateOthersWellFormed);
TESTCASE(TestSetExtensionValidateOthersIllFormed);
TESTCASE(TestSetLocale);
/*
TESTCASE(TestPosixCases);
*/
}

0 comments on commit e88b57d

Please sign in to comment.