diff --git a/icu4c/source/test/intltest/itspoof.cpp b/icu4c/source/test/intltest/itspoof.cpp index 8980eb1f673..1e2ec174c8b 100644 --- a/icu4c/source/test/intltest/itspoof.cpp +++ b/icu4c/source/test/intltest/itspoof.cpp @@ -91,6 +91,7 @@ void IntlTestSpoof::runIndexedTest( int32_t index, UBool exec, const char* &name TESTCASE_AUTO(testBug12825); TESTCASE_AUTO(testBug12815); TESTCASE_AUTO(testBug13314_MixedNumbers); + TESTCASE_AUTO(testBug13328_MixedCombiningMarks); TESTCASE_AUTO_END; } @@ -697,4 +698,16 @@ void IntlTestSpoof::testBug13314_MixedNumbers() { assertEquals("The '33' string does not fail spoof", 0, failedChecks); } +void IntlTestSpoof::testBug13328_MixedCombiningMarks() { + UErrorCode status = U_ZERO_ERROR; + LocalUSpoofCheckerPointer sc(uspoof_open(&status)); + TEST_ASSERT_SUCCESS(status); + int32_t failedChecks = uspoof_check2UnicodeString(sc.getAlias(), u"\u0061\u0F84", nullptr, &status); + TEST_ASSERT_SUCCESS(status); + assertEquals( + "The mismatched combining marks string fails spoof", + USPOOF_RESTRICTION_LEVEL, + failedChecks); +} + #endif /* !UCONFIG_NO_REGULAR_EXPRESSIONS && !UCONFIG_NO_NORMALIZATION && !UCONFIG_NO_FILE_IO */ diff --git a/icu4c/source/test/intltest/itspoof.h b/icu4c/source/test/intltest/itspoof.h index e7124bd6c41..f3212a19821 100644 --- a/icu4c/source/test/intltest/itspoof.h +++ b/icu4c/source/test/intltest/itspoof.h @@ -52,6 +52,8 @@ public: void testBug13314_MixedNumbers(); + void testBug13328_MixedCombiningMarks(); + // 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); diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/text/SpoofCheckerTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/text/SpoofCheckerTest.java index 44bcfb0909c..06dc008323b 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/text/SpoofCheckerTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/text/SpoofCheckerTest.java @@ -845,4 +845,14 @@ public class SpoofCheckerTest extends TestFmwk { SpoofChecker sc2 = new SpoofChecker.Builder(sc1).build(); assertEquals("Copy constructor should produce identical instances", sc1, sc2); } + + @Test + public void testBug13328_MixedCombiningMarks() { + SpoofChecker sc = new SpoofChecker.Builder().build(); + CheckResult checkResult = new CheckResult(); + sc.failsChecks("\u0061\u0F84", checkResult); + assertEquals("The mismatched combining marks string fails spoof", + SpoofChecker.RESTRICTION_LEVEL, + checkResult.checks); + } }