From cdcb7944b80301b6cde18587fff491c31684685c Mon Sep 17 00:00:00 2001 From: Norbert Runge Date: Mon, 27 Mar 2017 18:22:11 +0000 Subject: [PATCH] ICU-13053 Make UCONFIG_NO_BREAK_ITERATION flag work without errors or failures. X-SVN-Rev: 39943 --- icu4c/source/common/unicode/locdspnm.h | 1 + icu4c/source/i18n/unicode/dtfmtsym.h | 1 + icu4c/source/test/intltest/strcase.cpp | 17 +++++++++++++++-- icu4c/source/test/intltest/transtst.cpp | 3 ++- 4 files changed, 19 insertions(+), 3 deletions(-) diff --git a/icu4c/source/common/unicode/locdspnm.h b/icu4c/source/common/unicode/locdspnm.h index 63f46dfff68..7f227829b4c 100644 --- a/icu4c/source/common/unicode/locdspnm.h +++ b/icu4c/source/common/unicode/locdspnm.h @@ -20,6 +20,7 @@ #if !UCONFIG_NO_FORMATTING #include "unicode/locid.h" +#include "unicode/strenum.h" #include "unicode/uscript.h" #include "unicode/uldnames.h" #include "unicode/udisplaycontext.h" diff --git a/icu4c/source/i18n/unicode/dtfmtsym.h b/icu4c/source/i18n/unicode/dtfmtsym.h index 0cf3ce20ac6..fe914b461e6 100644 --- a/icu4c/source/i18n/unicode/dtfmtsym.h +++ b/icu4c/source/i18n/unicode/dtfmtsym.h @@ -25,6 +25,7 @@ #if !UCONFIG_NO_FORMATTING #include "unicode/calendar.h" +#include "unicode/strenum.h" #include "unicode/uobject.h" #include "unicode/locid.h" #include "unicode/udat.h" diff --git a/icu4c/source/test/intltest/strcase.cpp b/icu4c/source/test/intltest/strcase.cpp index 037a090ea3f..a7c07c928fa 100644 --- a/icu4c/source/test/intltest/strcase.cpp +++ b/icu4c/source/test/intltest/strcase.cpp @@ -779,11 +779,14 @@ void StringCaseTest::TestMalformedUTF8() { } char src[1] = { (char)0x85 }; // malformed UTF-8 char dest[3] = { 0, 0, 0 }; - int32_t destLength = ucasemap_utf8ToTitle(csm.getAlias(), dest, 3, src, 1, errorCode); + int32_t destLength; +#if !UCONFIG_NO_BREAK_ITERATION + destLength = ucasemap_utf8ToTitle(csm.getAlias(), dest, 3, src, 1, errorCode); if (errorCode.isFailure() || destLength != 1 || dest[0] != src[0]) { errln("ucasemap_utf8ToTitle(\\x85) failed: %s destLength=%d dest[0]=0x%02x", errorCode.errorName(), (int)destLength, dest[0]); } +#endif errorCode.reset(); dest[0] = 0; @@ -821,22 +824,27 @@ void StringCaseTest::TestBufferOverflow() { } UnicodeString data("hello world"); - int32_t result = ucasemap_toTitle(csm.getAlias(), NULL, 0, data.getBuffer(), data.length(), errorCode); + int32_t result; +#if !UCONFIG_NO_BREAK_ITERATION + result = ucasemap_toTitle(csm.getAlias(), NULL, 0, data.getBuffer(), data.length(), errorCode); if (errorCode.get() != U_BUFFER_OVERFLOW_ERROR || result != data.length()) { errln("%s:%d ucasemap_toTitle(\"hello world\") failed: " "expected (U_BUFFER_OVERFLOW_ERROR, %d), got (%s, %d)", __FILE__, __LINE__, data.length(), errorCode.errorName(), result); } +#endif errorCode.reset(); std::string data_utf8; data.toUTF8String(data_utf8); +#if !UCONFIG_NO_BREAK_ITERATION result = ucasemap_utf8ToTitle(csm.getAlias(), NULL, 0, data_utf8.c_str(), data_utf8.length(), errorCode); if (errorCode.get() != U_BUFFER_OVERFLOW_ERROR || result != (int32_t)data_utf8.length()) { errln("%s:%d ucasemap_toTitle(\"hello world\") failed: " "expected (U_BUFFER_OVERFLOW_ERROR, %d), got (%s, %d)", __FILE__, __LINE__, data_utf8.length(), errorCode.errorName(), result); } +#endif errorCode.reset(); } @@ -994,6 +1002,8 @@ void StringCaseTest::TestCaseMapWithEdits() { TRUE, errorCode); edits.reset(); + +#if !UCONFIG_NO_BREAK_ITERATION length = CaseMap::toTitle("nl", UCASEMAP_OMIT_UNCHANGED_TEXT | U_TITLECASE_NO_BREAK_ADJUSTMENT | @@ -1010,6 +1020,7 @@ void StringCaseTest::TestCaseMapWithEdits() { edits.getFineIterator(), edits.getFineIterator(), titleExpectedChanges, UPRV_LENGTHOF(titleExpectedChanges), TRUE, errorCode); +#endif edits.reset(); length = CaseMap::fold(UCASEMAP_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I, @@ -1067,6 +1078,7 @@ void StringCaseTest::TestCaseMapUTF8WithEdits() { TRUE, errorCode); edits.reset(); +#if !UCONFIG_NO_BREAK_ITERATION length = CaseMap::utf8ToTitle("nl", UCASEMAP_OMIT_UNCHANGED_TEXT | U_TITLECASE_NO_BREAK_ADJUSTMENT | @@ -1084,6 +1096,7 @@ void StringCaseTest::TestCaseMapUTF8WithEdits() { edits.getFineIterator(), edits.getFineIterator(), titleExpectedChanges, UPRV_LENGTHOF(titleExpectedChanges), TRUE, errorCode); +#endif edits.reset(); length = CaseMap::utf8Fold(UCASEMAP_OMIT_UNCHANGED_TEXT | U_FOLD_CASE_EXCLUDE_SPECIAL_I, diff --git a/icu4c/source/test/intltest/transtst.cpp b/icu4c/source/test/intltest/transtst.cpp index 81ea178aec0..93e90337620 100644 --- a/icu4c/source/test/intltest/transtst.cpp +++ b/icu4c/source/test/intltest/transtst.cpp @@ -243,7 +243,8 @@ void TransliteratorTest::TestInstantiation() { if (t == 0) { #if UCONFIG_NO_BREAK_ITERATION // If UCONFIG_NO_BREAK_ITERATION is on, then only Thai should fail. - if (id.compare((UnicodeString)"Thai-Latin") != 0) + if (id.compare((UnicodeString)"Thai-Latn") != 0 && + id.compare((UnicodeString)"Thai-Latin") != 0) #endif dataerrln(UnicodeString("FAIL: Couldn't create ") + id + /*", parse error " + parseError.code +*/ -- 2.40.0