From: Michael Ow Date: Fri, 22 Feb 2013 03:24:01 +0000 (+0000) Subject: ICU-9802 Fix no data cintltst and intltest failures X-Git-Tag: milestone-59-0-1~3063 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=795b21007fb53304e71a83d9163f183556cee609;p=icu ICU-9802 Fix no data cintltst and intltest failures X-SVN-Rev: 33302 --- diff --git a/icu4c/source/i18n/tzfmt.cpp b/icu4c/source/i18n/tzfmt.cpp index f54193d7aa6..4089dfbe56d 100644 --- a/icu4c/source/i18n/tzfmt.cpp +++ b/icu4c/source/i18n/tzfmt.cpp @@ -334,6 +334,9 @@ TimeZoneFormat::TimeZoneFormat(const Locale& locale, UErrorCode& status) fTimeZoneNames = TimeZoneNames::createInstance(locale, status); // fTimeZoneGenericNames is lazily instantiated + if (U_FAILURE(status)) { + return; + } const UChar* gmtPattern = NULL; const UChar* hourFormats = NULL; diff --git a/icu4c/source/i18n/uspoof.cpp b/icu4c/source/i18n/uspoof.cpp index 68531228e2b..87b12c955d0 100644 --- a/icu4c/source/i18n/uspoof.cpp +++ b/icu4c/source/i18n/uspoof.cpp @@ -85,7 +85,7 @@ static void initializeStatics() { gNfdNormalizer = Normalizer2::getNFDInstance(status); } ucln_i18n_registerCleanup(UCLN_I18N_SPOOF, uspoof_cleanup); - U_ASSERT(U_SUCCESS(status)); // TODO: remove after testing. + return; } diff --git a/icu4c/source/test/intltest/alphaindextst.cpp b/icu4c/source/test/intltest/alphaindextst.cpp index 9e7e75f123a..9e025496e21 100644 --- a/icu4c/source/test/intltest/alphaindextst.cpp +++ b/icu4c/source/test/intltest/alphaindextst.cpp @@ -545,6 +545,11 @@ void AlphabeticIndexTest::TestHaniFirst() { UErrorCode status = U_ZERO_ERROR; LocalPointer coll( static_cast(Collator::createInstance(Locale::getRoot(), status))); + + if (U_FAILURE(status)) { + dataerrln("Failed Collator::createInstance call - %s", u_errorName(status)); + return; + } int32_t reorderCodes[] = { USCRIPT_HAN }; coll->setReorderCodes(reorderCodes, LENGTHOF(reorderCodes), status); TEST_CHECK_STATUS; @@ -570,6 +575,10 @@ void AlphabeticIndexTest::TestPinyinFirst() { UErrorCode status = U_ZERO_ERROR; LocalPointer coll( static_cast(Collator::createInstance(Locale::getChinese(), status))); + if (U_FAILURE(status)) { + dataerrln("Failed Collator::createInstance call - %s", u_errorName(status)); + return; + } int32_t reorderCodes[] = { USCRIPT_HAN }; coll->setReorderCodes(reorderCodes, LENGTHOF(reorderCodes), status); TEST_CHECK_STATUS; diff --git a/icu4c/source/test/intltest/itspoof.cpp b/icu4c/source/test/intltest/itspoof.cpp index 7aeeea788b3..fca60668043 100644 --- a/icu4c/source/test/intltest/itspoof.cpp +++ b/icu4c/source/test/intltest/itspoof.cpp @@ -32,17 +32,17 @@ errcheckln(status, "Failure at file %s, line %d, error = %s", __FILE__, __LINE__, u_errorName(status));}} #define TEST_ASSERT(expr) {if ((expr)==FALSE) { \ - errln("Test Failure at file %s, line %d: \"%s\" is false.\n", __FILE__, __LINE__, #expr);};} + errln("Test Failure at file %s, line %d: \"%s\" is false.", __FILE__, __LINE__, #expr);};} #define TEST_ASSERT_MSG(expr, msg) {if ((expr)==FALSE) { \ - errln("Test Failure at file %s, line %d, %s: \"%s\" is false.\n", __FILE__, __LINE__, msg, #expr);};} + dataerrln("Test Failure at file %s, line %d, %s: \"%s\" is false.", __FILE__, __LINE__, msg, #expr);};} #define TEST_ASSERT_EQ(a, b) { if ((a) != (b)) { \ - errln("Test Failure at file %s, line %d: \"%s\" (%d) != \"%s\" (%d) \n", \ + errln("Test Failure at file %s, line %d: \"%s\" (%d) != \"%s\" (%d)", \ __FILE__, __LINE__, #a, (a), #b, (b)); }} #define TEST_ASSERT_NE(a, b) { if ((a) == (b)) { \ - errln("Test Failure at file %s, line %d: \"%s\" (%d) == \"%s\" (%d) \n", \ + errln("Test Failure at file %s, line %d: \"%s\" (%d) == \"%s\" (%d)", \ __FILE__, __LINE__, #a, (a), #b, (b)); }} #define LENGTHOF(array) ((int32_t)(sizeof(array)/sizeof((array)[0])))