From a1c0ac5b1426033183385e5873e938348cf19373 Mon Sep 17 00:00:00 2001 From: Andy Heninger Date: Sat, 12 May 2018 22:37:33 +0000 Subject: [PATCH] ICU-11647 Port Test11647() from Java - pattern w four currency symbols. X-SVN-Rev: 41370 --- icu4c/source/test/intltest/numfmtst.cpp | 10 ++++++++++ icu4c/source/test/intltest/numfmtst.h | 1 + 2 files changed, 11 insertions(+) diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 6088522df8..fc061d9e35 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -679,6 +679,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n TESTCASE_AUTO(Test11649_DecFmtCurrencies); TESTCASE_AUTO(Test13148_ParseGroupingSeparators); TESTCASE_AUTO(Test12753_PatternDecimalPoint); + TESTCASE_AUTO(Test11647_PatternCurrencySymbols); TESTCASE_AUTO_END; } @@ -9503,4 +9504,13 @@ void NumberFormatTest::Test12753_PatternDecimalPoint() { U_INVALID_FORMAT_ERROR, status); } + void NumberFormatTest::Test11647_PatternCurrencySymbols() { + UErrorCode status = U_ZERO_ERROR; + DecimalFormat df(status); + df.applyPattern(u"¤¤¤¤#", status); + if (!assertSuccess("", status)) return; + UnicodeString actual; + df.format(123, actual); + assertEquals("Should replace 4 currency signs with U+FFFD", "\uFFFD123", actual); +} #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numfmtst.h b/icu4c/source/test/intltest/numfmtst.h index 84cf97cfa6..76feaa99c8 100644 --- a/icu4c/source/test/intltest/numfmtst.h +++ b/icu4c/source/test/intltest/numfmtst.h @@ -243,6 +243,7 @@ class NumberFormatTest: public CalendarTimeZoneTest { void Test11649_DecFmtCurrencies(); void Test13148_ParseGroupingSeparators(); void Test12753_PatternDecimalPoint(); + void Test11647_PatternCurrencySymbols(); private: UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);