TESTCASE_AUTO(TestMultiplierWithScale);
TESTCASE_AUTO(TestFastFormatInt32);
TESTCASE_AUTO(TestParseNaN);
+ TESTCASE_AUTO(Test11897_LocalizedPatternSeparator);
TESTCASE_AUTO_END;
}
assertEquals("NaN should round-trip", u"NaN", formatResult);
}
+void NumberFormatTest::Test11897_LocalizedPatternSeparator() {
+ IcuTestErrorCode status(*this, "Test11897_LocalizedPatternSeparator");
+
+ DecimalFormatSymbols dfs("en", status);
+ dfs.setSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol, u"!", FALSE);
+ DecimalFormat df(u"0", dfs, status);
+ df.applyPattern("a0;b0", status); // should not throw
+ UnicodeString result;
+ assertEquals("should apply the normal pattern", df.getNegativePrefix(result.remove()), "b");
+ df.applyLocalizedPattern(u"c0!d0", status); // should not throw
+ assertEquals("should apply the localized pattern", df.getNegativePrefix(result.remove()), "d");
+}
+
#endif /* #if !UCONFIG_NO_FORMATTING */
void TestMultiplierWithScale();
void TestFastFormatInt32();
void TestParseNaN();
+ void Test11897_LocalizedPatternSeparator();
private:
UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);
Number number = fmt.parse("300,000");
assertEquals("Should use custom symbols and not monetary symbols", 300000L, number);
}
+
+ @Test
+ public void test11897_LocalizedPatternSeparator() {
+ DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(ULocale.ENGLISH);
+ dfs.setPatternSeparator('!');
+ DecimalFormat df = new DecimalFormat("0", dfs);
+ df.applyPattern("a0;b0"); // should not throw
+ assertEquals("should apply the normal pattern", df.getNegativePrefix(), "b");
+ df.applyLocalizedPattern("c0!d0"); // should not throw
+ assertEquals("should apply the localized pattern", df.getNegativePrefix(), "d");
+ }
}