summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp')
-rw-r--r--Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp b/Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp
index 97700251a38..e6e90780145 100644
--- a/Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp
+++ b/Build/source/libs/icu/icu-src/source/test/intltest/itrbnf.cpp
@@ -75,6 +75,7 @@ void IntlTestRBNF::runIndexedTest(int32_t index, UBool exec, const char* &name,
TESTCASE(23, TestVariableDecimalPoint);
TESTCASE(24, TestLargeNumbers);
TESTCASE(25, TestCompactDecimalFormatStyle);
+ TESTCASE(26, TestParseFailure);
#else
TESTCASE(0, TestRBNFDisabled);
#endif
@@ -2283,6 +2284,22 @@ void IntlTestRBNF::TestCompactDecimalFormatStyle() {
doTest(&rbnf, enTestFullData, false);
}
+void IntlTestRBNF::TestParseFailure() {
+ UErrorCode status = U_ZERO_ERROR;
+ RuleBasedNumberFormat rbnf(URBNF_SPELLOUT, Locale::getJapanese(), status);
+ static const UChar* testData[] = {
+ u"・・・・・・・・・・・・・・・・・・・・・・・・"
+ };
+ for (int i = 0; i < UPRV_LENGTHOF(testData); ++i) {
+ UnicodeString spelledNumberString(testData[i]);
+ Formattable actualNumber;
+ rbnf.parse(spelledNumberString, actualNumber, status);
+ if (status != U_INVALID_FORMAT_ERROR) { // I would have expected U_PARSE_ERROR, but NumberFormat::parse gives U_INVALID_FORMAT_ERROR
+ errln("FAIL: string should be unparseable index=%d %s", i, u_errorName(status));
+ }
+ }
+}
+
void
IntlTestRBNF::doTest(RuleBasedNumberFormat* formatter, const char* const testData[][2], UBool testParsing)
{