From 20ae9261947dce1b705ee80eacad85c34d72e58b Mon Sep 17 00:00:00 2001 From: Peter Edberg Date: Sun, 19 May 2013 06:36:13 +0000 Subject: [PATCH] ICU-10120 Copy fix #9983 (for word ubrk_previous infinite loop) to word_POSIX too X-SVN-Rev: 33682 --- icu4c/source/data/brkitr/word_POSIX.txt | 4 ++-- icu4c/source/test/intltest/rbbitst.cpp | 22 +++++++++++++++++++--- icu4c/source/test/testdata/rbbitst.txt | 1 + 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/icu4c/source/data/brkitr/word_POSIX.txt b/icu4c/source/data/brkitr/word_POSIX.txt index 3cd0372db66..fbab7573e30 100644 --- a/icu4c/source/data/brkitr/word_POSIX.txt +++ b/icu4c/source/data/brkitr/word_POSIX.txt @@ -96,7 +96,7 @@ $CR $LF; # begins with a group of Format chars, or with a "word" consisting of a single # char that is not in any of the listed word break categories followed by # format char(s), or is not a CJK dictionary character. -[^$CR $LF $Newline $dictionaryCJK]? ($Extend | $Format)+; +[^$CR $LF $Newline]? ($Extend | $Format)+; $NumericEx {100}; $ALetterEx {200}; @@ -186,7 +186,7 @@ $BackRegional_IndicatorEx = ($Format | $Extend)* $Regional_Indicator; $LF $CR; # rule 4 -($Format | $Extend)* [^$CR $LF $Newline $dictionaryCJK]?; +($Format | $Extend)* [^$CR $LF $Newline]?; # rule 5 diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index c7f66aa8e21..00cc6d0f048 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -4261,18 +4261,34 @@ void RBBITest::TestBug9983(void) { LocalPointer brkiter(static_cast( BreakIterator::createWordInstance(Locale::getRoot(), status))); TEST_ASSERT_SUCCESS(status); + LocalPointer brkiterPOSIX(static_cast( + BreakIterator::createWordInstance(Locale::createFromName("en_US_POSIX"), status))); + TEST_ASSERT_SUCCESS(status); if (U_FAILURE(status)) { return; } + int32_t offset, rstatus, iterationCount; + brkiter->setText(text); - int32_t offset, rstatus; brkiter->last(); - int32_t iterationCount = 0; + iterationCount = 0; while ( (offset = brkiter->previous()) != UBRK_DONE ) { iterationCount++; rstatus = brkiter->getRuleStatus(); (void)rstatus; // Suppress set but not used warning. - // printf(" %d(%d)", offset, rstatus); + if (iterationCount >= 10) { + break; + } + } + TEST_ASSERT(iterationCount == 6); + + brkiterPOSIX->setText(text); + brkiterPOSIX->last(); + iterationCount = 0; + while ( (offset = brkiterPOSIX->previous()) != UBRK_DONE ) { + iterationCount++; + rstatus = brkiterPOSIX->getRuleStatus(); + (void)rstatus; // Suppress set but not used warning. if (iterationCount >= 10) { break; } diff --git a/icu4c/source/test/testdata/rbbitst.txt b/icu4c/source/test/testdata/rbbitst.txt index 5dde3f8c951..4231d271f60 100644 --- a/icu4c/source/test/testdata/rbbitst.txt +++ b/icu4c/source/test/testdata/rbbitst.txt @@ -790,6 +790,7 @@ Bangkok)• •Can't<200> •have<200> •breaks<200> •in<200> •xx<200>:•yy<200> •or<200> •struct<200>.•field<200> \ •for<200> •CS<200>-•types<200>.• +•\u06c9<200>\uc799\ufffa• # UBreakIteratorType UBRK_CHARACTER, Locale "th" -- 2.49.0