]> granicus.if.org Git - icu/commitdiff
ICU-11123 promote RegexMatcher::find(UErrorCode &) to public API
authorAndy Heninger <andy.heninger@gmail.com>
Thu, 26 Feb 2015 02:34:20 +0000 (02:34 +0000)
committerAndy Heninger <andy.heninger@gmail.com>
Thu, 26 Feb 2015 02:34:20 +0000 (02:34 +0000)
X-SVN-Rev: 37073

icu4c/source/i18n/unicode/regex.h
icu4c/source/test/intltest/regextst.cpp

index 90478e461facafbc261f515dc0f4a47b0ac15cd8..c3c6441b6f8cb4ff632a878a73088d48a43fe574 100644 (file)
@@ -849,7 +849,7 @@ public:
     *     position may not be valid with the altered input string.</p>
     *  @param   status  A reference to a UErrorCode to receive any errors.
     *  @return  TRUE if a match is found.
-    *  @internal
+    *  @draft ICU 55
     */
     virtual UBool find(UErrorCode &status);
 
index b3ad8ccdfbe84f504e094d844be996c7fa44728d..c488e0e25dbe7f8a28c6be150270f606cbf7854f 100644 (file)
@@ -4879,6 +4879,15 @@ void RegexTest::Callbacks() {
         REGEX_ASSERT(matcher.matches(status)==FALSE);
         REGEX_ASSERT(status == U_REGEX_STOPPED_BY_CALLER);
         REGEX_ASSERT(cbInfo.numCalls == 4);
+
+        // A longer running find that the callback function will abort.
+        status = U_ZERO_ERROR;
+        cbInfo.reset(4);
+        s = "aaaaaaaaaaaaaaaaaaaaaaab";
+        matcher.reset(s);
+        REGEX_ASSERT(matcher.find(status)==FALSE);
+        REGEX_ASSERT(status == U_REGEX_STOPPED_BY_CALLER);
+        REGEX_ASSERT(cbInfo.numCalls == 4);
     }