#if !UCONFIG_NO_NORMALIZATION
-
-#include <stdio.h> // debug
-
U_NAMESPACE_USE
UBool haveMultipleMarks = FALSE;
UnicodeSet marksSeenSoFar; // Set of combining marks in a single combining sequence.
- for (i=0; i<length ;) {
+ for (i=0; i<nfdLength ;) {
U16_NEXT(nfdText, i, nfdLength, c);
if (u_charType(c) != U_NON_SPACING_MARK) {
firstNonspacingMark = 0;
// No need to find more than the first failure.
result |= USPOOF_INVISIBLE;
failPos = i;
+ // TODO: Bug 8655: failPos is the position in the NFD buffer, but what we want
+ // to give back to our caller is a position in the original input string.
+ if (failPos > length) {
+ failPos = length;
+ }
break;
}
marksSeenSoFar.add(c);
testConfData();
}
break;
- default: name=""; break;
+ case 5:
+ name = "testBug8654";
+ if (exec) {
+ testBug8654();
+ }
+ break;
+ default: name=""; break;
}
}
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();
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
/*
**********************************************************************
-* Copyright (C) 2009, International Business Machines Corporation
+* Copyright (C) 2011, International Business Machines Corporation
* and others. All Rights Reserved.
**********************************************************************
*/
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);