]> granicus.if.org Git - icu/commitdiff
ICU-13053 Make UCONFIG_NO_BREAK_ITERATION flag work without errors or failures.
authorNorbert Runge <nrunge@google.com>
Mon, 27 Mar 2017 18:22:11 +0000 (18:22 +0000)
committerNorbert Runge <nrunge@google.com>
Mon, 27 Mar 2017 18:22:11 +0000 (18:22 +0000)
X-SVN-Rev: 39943

icu4c/source/common/unicode/locdspnm.h
icu4c/source/i18n/unicode/dtfmtsym.h
icu4c/source/test/intltest/strcase.cpp
icu4c/source/test/intltest/transtst.cpp

index 63f46dfff68b9cb2b91c7354f44054e617aaec06..7f227829b4cc00d4e7c5563cd91c85357344e36c 100644 (file)
@@ -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"
index 0cf3ce20ac6f54263e4fc4323db64b5a25aea0e4..fe914b461e6249f602e7ee511388836a804a2cdf 100644 (file)
@@ -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"
index 037a090ea3f8a5b98acfc7a3e2ba0f5093f62738..a7c07c928fa15f53f19e5921c1d7e65da72ca3aa 100644 (file)
@@ -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,
index 81ea178aec039de0fee0016095e4c81dbb7bf1e2..93e90337620aa6a267430266dec5f2e9cb38f826 100644 (file)
@@ -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 +*/