mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-13644 Returning bogus string when toSkeleton() fails.
X-SVN-Rev: 41367
This commit is contained in:
parent
3eb414943e
commit
f86a35be55
2 changed files with 13 additions and 3 deletions
|
@ -320,7 +320,7 @@ Derived NumberFormatterSettings<Derived>::macros(impl::MacroProps&& macros)&& {
|
|||
template<typename Derived>
|
||||
UnicodeString NumberFormatterSettings<Derived>::toSkeleton(UErrorCode& status) const {
|
||||
if (fMacros.copyErrorTo(status)) {
|
||||
return {};
|
||||
return ICU_Utility::makeBogusString();
|
||||
}
|
||||
return skeleton::generate(fMacros, status);
|
||||
}
|
||||
|
|
|
@ -2192,6 +2192,17 @@ void NumberFormatterApiTest::errors() {
|
|||
U_NUMBER_ARG_OUTOFBOUNDS_ERROR,
|
||||
status);
|
||||
|
||||
// Skeleton string
|
||||
status = U_ZERO_ERROR;
|
||||
UnicodeString output = lnf.toSkeleton(status);
|
||||
assertEquals(
|
||||
"Should fail on toSkeleton terminal method with correct error code",
|
||||
U_NUMBER_ARG_OUTOFBOUNDS_ERROR,
|
||||
status);
|
||||
assertTrue(
|
||||
"Terminal toSkeleton on error object should be bogus",
|
||||
output.isBogus());
|
||||
|
||||
// FieldPosition
|
||||
status = U_ZERO_ERROR;
|
||||
FieldPosition fp;
|
||||
|
@ -2212,8 +2223,7 @@ void NumberFormatterApiTest::errors() {
|
|||
|
||||
// Appendable
|
||||
status = U_ZERO_ERROR;
|
||||
UnicodeString output;
|
||||
UnicodeStringAppendable appendable(output);
|
||||
UnicodeStringAppendable appendable(output.remove());
|
||||
fn.appendTo(appendable, status);
|
||||
assertEquals(
|
||||
"Should fail on Appendable terminal method with correct error code",
|
||||
|
|
Loading…
Add table
Reference in a new issue