diff --git a/icu4c/source/i18n/uspoof.cpp b/icu4c/source/i18n/uspoof.cpp index 48e3e45dc49..58a706f0799 100644 --- a/icu4c/source/i18n/uspoof.cpp +++ b/icu4c/source/i18n/uspoof.cpp @@ -24,9 +24,6 @@ #if !UCONFIG_NO_NORMALIZATION - -#include // debug - U_NAMESPACE_USE @@ -255,7 +252,7 @@ uspoof_check(const USpoofChecker *sc, UBool haveMultipleMarks = FALSE; UnicodeSet marksSeenSoFar; // Set of combining marks in a single combining sequence. - for (i=0; i length) { + failPos = length; + } break; } marksSeenSoFar.add(c); diff --git a/icu4c/source/test/intltest/itspoof.cpp b/icu4c/source/test/intltest/itspoof.cpp index dd2c2763999..08c651a66f2 100644 --- a/icu4c/source/test/intltest/itspoof.cpp +++ b/icu4c/source/test/intltest/itspoof.cpp @@ -91,7 +91,13 @@ void IntlTestSpoof::runIndexedTest( int32_t index, UBool exec, const char* &name testConfData(); } break; - default: name=""; break; + case 5: + name = "testBug8654"; + if (exec) { + testBug8654(); + } + break; + default: name=""; break; } } @@ -251,7 +257,7 @@ void IntlTestSpoof::testInvisible() { TEST_ASSERT_SUCCESS(status); TEST_ASSERT_EQ(7, position); - // Tow acute accents, one from the composed a with acute accent, \u00e1, + // Two acute accents, one from the composed a with acute accent, \u00e1, // and one separate. position = -42; UnicodeString s3 = UnicodeString("abcd\\u00e1\\u0301xyz").unescape(); @@ -261,6 +267,15 @@ void IntlTestSpoof::testInvisible() { TEST_TEARDOWN; } +void IntlTestSpoof::testBug8654() { + TEST_SETUP + UnicodeString s = UnicodeString("B\u00c1\u0301").unescape(); + int32_t position = -42; + TEST_ASSERT_EQ(USPOOF_INVISIBLE, uspoof_checkUnicodeString(sc, s, &position, &status) & USPOOF_INVISIBLE ); + TEST_ASSERT_SUCCESS(status); + TEST_ASSERT_EQ(3, position); + TEST_TEARDOWN; +} static UnicodeString parseHex(const UnicodeString &in) { // Convert a series of hex numbers in a Unicode String to a string with the diff --git a/icu4c/source/test/intltest/itspoof.h b/icu4c/source/test/intltest/itspoof.h index 6a77459ca10..abd54f5a930 100644 --- a/icu4c/source/test/intltest/itspoof.h +++ b/icu4c/source/test/intltest/itspoof.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 2009, International Business Machines Corporation +* Copyright (C) 2011, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************** */ @@ -34,6 +34,8 @@ public: void testConfData(); + void testBug8654(); + // Internal function to run a single skeleton test case. void checkSkeleton(const USpoofChecker *sc, uint32_t flags, const char *input, const char *expected, int32_t lineNum);