ICU-10354 port NumberFormatTest.Test10354 to C++
X-SVN-Rev: 41332
This commit is contained in:
parent
1b4baff50e
commit
5cf4bdf6db
@ -662,6 +662,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
|
||||
TESTCASE_AUTO(TestFastFormatInt32);
|
||||
TESTCASE_AUTO(TestParseNaN);
|
||||
TESTCASE_AUTO(Test11897_LocalizedPatternSeparator);
|
||||
TESTCASE_AUTO(Test10354);
|
||||
TESTCASE_AUTO_END;
|
||||
}
|
||||
|
||||
@ -9148,4 +9149,18 @@ void NumberFormatTest::Test11897_LocalizedPatternSeparator() {
|
||||
assertEquals("should apply the localized pattern", df.getNegativePrefix(result.remove()), "d");
|
||||
}
|
||||
|
||||
void NumberFormatTest::Test10354() {
|
||||
IcuTestErrorCode errorCode(*this, "Test10354");
|
||||
// Ticket #10354: invalid FieldPositionIterator when formatting with empty NaN
|
||||
DecimalFormatSymbols dfs(errorCode);
|
||||
UnicodeString empty;
|
||||
dfs.setSymbol(DecimalFormatSymbols::kNaNSymbol, empty);
|
||||
DecimalFormat df(errorCode);
|
||||
df.setDecimalFormatSymbols(dfs);
|
||||
UnicodeString result;
|
||||
FieldPositionIterator positions;
|
||||
df.format(NAN, result, &positions, errorCode);
|
||||
errorCode.logIfFailureAndReset("DecimalFormat.format(NAN, FieldPositionIterator) failed");
|
||||
}
|
||||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
@ -227,6 +227,7 @@ class NumberFormatTest: public CalendarTimeZoneTest {
|
||||
void TestFastFormatInt32();
|
||||
void TestParseNaN();
|
||||
void Test11897_LocalizedPatternSeparator();
|
||||
void Test10354();
|
||||
|
||||
private:
|
||||
UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);
|
||||
|
Loading…
Reference in New Issue
Block a user