ICU-13757 Renaming skeleton methods fromSkeleton -> forSkeleton
X-SVN-Rev: 41393
This commit is contained in:
parent
18263df394
commit
d7f3471733
@ -1707,7 +1707,7 @@ Format* MessageFormat::createAppropriateFormat(UnicodeString& type, UnicodeStrin
|
||||
if (style.compare(i, 2, u"::", 0, 2) == 0) {
|
||||
// Skeleton
|
||||
UnicodeString skeleton = style.tempSubString(i + 2);
|
||||
fmt = number::NumberFormatter::fromSkeleton(skeleton, ec).locale(fLocale).toFormat(ec);
|
||||
fmt = number::NumberFormatter::forSkeleton(skeleton, ec).locale(fLocale).toFormat(ec);
|
||||
} else {
|
||||
// Pattern
|
||||
fmt = NumberFormat::createInstance(fLocale, ec);
|
||||
|
@ -83,8 +83,8 @@ UFormattedNumber* UFormattedNumberData::exportForC() {
|
||||
|
||||
|
||||
U_CAPI UNumberFormatter* U_EXPORT2
|
||||
unumf_openFromSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
|
||||
UErrorCode* ec) {
|
||||
unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
|
||||
UErrorCode* ec) {
|
||||
auto* impl = new UNumberFormatterData();
|
||||
if (impl == nullptr) {
|
||||
*ec = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -92,7 +92,7 @@ unumf_openFromSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, cons
|
||||
}
|
||||
// Readonly-alias constructor (first argument is whether we are NUL-terminated)
|
||||
UnicodeString skeletonString(skeletonLen == -1, skeleton, skeletonLen);
|
||||
impl->fFormatter = NumberFormatter::fromSkeleton(skeletonString, *ec).locale(locale);
|
||||
impl->fFormatter = NumberFormatter::forSkeleton(skeletonString, *ec).locale(locale);
|
||||
return impl->exportForC();
|
||||
}
|
||||
|
||||
|
@ -344,7 +344,7 @@ LocalizedNumberFormatter NumberFormatter::withLocale(const Locale& locale) {
|
||||
}
|
||||
|
||||
UnlocalizedNumberFormatter
|
||||
NumberFormatter::fromSkeleton(const UnicodeString& skeleton, UErrorCode& status) {
|
||||
NumberFormatter::forSkeleton(const UnicodeString& skeleton, UErrorCode& status) {
|
||||
return skeleton::create(skeleton, status);
|
||||
}
|
||||
|
||||
|
@ -2600,7 +2600,7 @@ class U_I18N_API NumberFormatter final {
|
||||
* @return An UnlocalizedNumberFormatter, to be used for chaining.
|
||||
* @draft ICU 62
|
||||
*/
|
||||
static UnlocalizedNumberFormatter fromSkeleton(const UnicodeString& skeleton, UErrorCode& status);
|
||||
static UnlocalizedNumberFormatter forSkeleton(const UnicodeString& skeleton, UErrorCode& status);
|
||||
|
||||
/**
|
||||
* Use factory methods instead of the constructor to create a NumberFormatter.
|
||||
|
@ -30,7 +30,7 @@
|
||||
* <pre>
|
||||
* // Setup:
|
||||
* UErrorCode ec = U_ZERO_ERROR;
|
||||
* UNumberFormatter* uformatter = unumf_openFromSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
|
||||
* UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
|
||||
* UFormattedNumber* uresult = unumf_openResult(&ec);
|
||||
* if (U_FAILURE(ec)) { return; }
|
||||
*
|
||||
@ -58,17 +58,17 @@
|
||||
*
|
||||
* <pre>
|
||||
* // Setup:
|
||||
* LocalUNumberFormatterPointer uformatter(unumf_openFromSkeletonAndLocale(u"percent", -1, "en", &ec));
|
||||
* LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec));
|
||||
* LocalUFormattedNumberPointer uresult(unumf_openResult(&ec));
|
||||
* if (U_FAILURE(ec)) { return; }
|
||||
*
|
||||
* // Format a decimal number:
|
||||
* unumf_formatDecimal(uformatter.getAlias(), "9.87E6", -1, uresult.getAlias(), &ec);
|
||||
* unumf_formatDecimal(uformatter.getAlias(), "9.87E-3", -1, uresult.getAlias(), &ec);
|
||||
* if (U_FAILURE(ec)) { return; }
|
||||
*
|
||||
* // Get the location of the percent sign:
|
||||
* UFieldPosition ufpos = {UNUM_PERCENT_FIELD, 0, 0};
|
||||
* unumf_resultGetField(uresult.getAlias(), &ufpos, &ec);
|
||||
* unumf_resultNextFieldPosition(uresult.getAlias(), &ufpos, &ec);
|
||||
* // ufpos should contain beginIndex=7 and endIndex=8 since the string is "0.00987%"
|
||||
*
|
||||
* // No need to do any cleanup since we are using LocalPointer.
|
||||
@ -413,7 +413,7 @@ typedef struct UFormattedNumber UFormattedNumber;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new UNumberFormatter from the given skeleton string and locale. This is currently the only
|
||||
* Creates a new UNumberFormatter for the given skeleton string and locale. This is currently the only
|
||||
* method for creating a new UNumberFormatter.
|
||||
*
|
||||
* Objects of type UNumberFormatter returned by this method are threadsafe.
|
||||
@ -430,8 +430,8 @@ typedef struct UFormattedNumber UFormattedNumber;
|
||||
* @draft ICU 62
|
||||
*/
|
||||
U_DRAFT UNumberFormatter* U_EXPORT2
|
||||
unumf_openFromSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
|
||||
UErrorCode* ec);
|
||||
unumf_openForSkeletonAndLocale(const UChar* skeleton, int32_t skeletonLen, const char* locale,
|
||||
UErrorCode* ec);
|
||||
|
||||
|
||||
/**
|
||||
@ -457,7 +457,7 @@ unumf_openResult(UErrorCode* ec);
|
||||
*
|
||||
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
||||
*
|
||||
* @param uformatter A formatter object created by unumf_openFromSkeletonAndLocale or similar.
|
||||
* @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
|
||||
* @param value The number to be formatted.
|
||||
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
|
||||
* @param ec Set if an error occurs.
|
||||
@ -477,7 +477,7 @@ unumf_formatInt(const UNumberFormatter* uformatter, int64_t value, UFormattedNum
|
||||
*
|
||||
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
||||
*
|
||||
* @param uformatter A formatter object created by unumf_openFromSkeletonAndLocale or similar.
|
||||
* @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
|
||||
* @param value The number to be formatted.
|
||||
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
|
||||
* @param ec Set if an error occurs.
|
||||
@ -500,7 +500,7 @@ unumf_formatDouble(const UNumberFormatter* uformatter, double value, UFormattedN
|
||||
*
|
||||
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
||||
*
|
||||
* @param uformatter A formatter object created by unumf_openFromSkeletonAndLocale or similar.
|
||||
* @param uformatter A formatter object created by unumf_openForSkeletonAndLocale or similar.
|
||||
* @param value The numeric string to be formatted.
|
||||
* @param valueLen The length of the numeric string, or -1 if it is NUL-terminated.
|
||||
* @param uresult The object that will be mutated to store the result; see unumf_openResult.
|
||||
@ -589,11 +589,11 @@ unumf_resultGetAllFieldPositions(const UFormattedNumber* uresult, UFieldPosition
|
||||
|
||||
|
||||
/**
|
||||
* Releases the UNumberFormatter created by unumf_openFromSkeletonAndLocale().
|
||||
* Releases the UNumberFormatter created by unumf_openForSkeletonAndLocale().
|
||||
*
|
||||
* NOTE: This is a C-compatible API; C++ users should build against numberformatter.h instead.
|
||||
*
|
||||
* @param uformatter An object created by unumf_openFromSkeletonAndLocale().
|
||||
* @param uformatter An object created by unumf_openForSkeletonAndLocale().
|
||||
* @draft ICU 62
|
||||
*/
|
||||
U_DRAFT void U_EXPORT2
|
||||
@ -622,7 +622,7 @@ U_NAMESPACE_BEGIN
|
||||
*
|
||||
* Usage:
|
||||
* <pre>
|
||||
* LocalUNumberFormatterPointer uformatter(unumf_openFromSkeletonAndLocale(...));
|
||||
* LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(...));
|
||||
* // no need to explicitly call unumf_close()
|
||||
* </pre>
|
||||
*
|
||||
|
@ -37,7 +37,7 @@ static void TestSkeletonFormatToString() {
|
||||
UChar buffer[CAPACITY];
|
||||
|
||||
// setup:
|
||||
UNumberFormatter* f = unumf_openFromSkeletonAndLocale(
|
||||
UNumberFormatter* f = unumf_openForSkeletonAndLocale(
|
||||
u"precision-integer currency/USD sign-accounting", -1, "en", &ec);
|
||||
assertSuccess("Should create without error", &ec);
|
||||
UFormattedNumber* result = unumf_openResult(&ec);
|
||||
@ -74,7 +74,7 @@ static void TestSkeletonFormatToFields() {
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
|
||||
// setup:
|
||||
UNumberFormatter* uformatter = unumf_openFromSkeletonAndLocale(
|
||||
UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(
|
||||
u".00 measure-unit/length-meter sign-always", -1, "en", &ec);
|
||||
assertSuccessCheck("Should create without error", &ec, TRUE);
|
||||
if (U_FAILURE(ec)) { return; }
|
||||
@ -153,7 +153,7 @@ static void TestExampleCode() {
|
||||
|
||||
// Setup:
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
UNumberFormatter* uformatter = unumf_openFromSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
|
||||
UNumberFormatter* uformatter = unumf_openForSkeletonAndLocale(u"precision-integer", -1, "en", &ec);
|
||||
UFormattedNumber* uresult = unumf_openResult(&ec);
|
||||
assertSuccessCheck("There should not be a failure in the example code", &ec, TRUE);
|
||||
if (U_FAILURE(ec)) { return; }
|
||||
|
@ -2411,7 +2411,7 @@ void NumberFormatterApiTest::localPointerCAPI() {
|
||||
UErrorCode ec = U_ZERO_ERROR;
|
||||
|
||||
// Setup:
|
||||
LocalUNumberFormatterPointer uformatter(unumf_openFromSkeletonAndLocale(u"percent", -1, "en", &ec));
|
||||
LocalUNumberFormatterPointer uformatter(unumf_openForSkeletonAndLocale(u"percent", -1, "en", &ec));
|
||||
LocalUFormattedNumberPointer uresult(unumf_openResult(&ec));
|
||||
assertSuccess("", ec, TRUE);
|
||||
if (U_FAILURE(ec)) { return; }
|
||||
@ -2458,9 +2458,9 @@ void NumberFormatterApiTest::assertFormatDescending(const char16_t* umessage, co
|
||||
UnicodeString skeleton(TRUE, uskeleton, -1);
|
||||
// Only compare normalized skeletons: the tests need not provide the normalized forms.
|
||||
// Use the normalized form to construct the testing formatter to guarantee no loss of info.
|
||||
UnicodeString normalized = NumberFormatter::fromSkeleton(skeleton, status).toSkeleton(status);
|
||||
UnicodeString normalized = NumberFormatter::forSkeleton(skeleton, status).toSkeleton(status);
|
||||
assertEquals(message + ": Skeleton:", normalized, f.toSkeleton(status));
|
||||
LocalizedNumberFormatter l3 = NumberFormatter::fromSkeleton(normalized, status).locale(locale);
|
||||
LocalizedNumberFormatter l3 = NumberFormatter::forSkeleton(normalized, status).locale(locale);
|
||||
for (int32_t i = 0; i < 9; i++) {
|
||||
double d = inputs[i];
|
||||
UnicodeString actual3 = l3.formatDouble(d, status).toString();
|
||||
@ -2499,9 +2499,9 @@ void NumberFormatterApiTest::assertFormatDescendingBig(const char16_t* umessage,
|
||||
UnicodeString skeleton(TRUE, uskeleton, -1);
|
||||
// Only compare normalized skeletons: the tests need not provide the normalized forms.
|
||||
// Use the normalized form to construct the testing formatter to guarantee no loss of info.
|
||||
UnicodeString normalized = NumberFormatter::fromSkeleton(skeleton, status).toSkeleton(status);
|
||||
UnicodeString normalized = NumberFormatter::forSkeleton(skeleton, status).toSkeleton(status);
|
||||
assertEquals(message + ": Skeleton:", normalized, f.toSkeleton(status));
|
||||
LocalizedNumberFormatter l3 = NumberFormatter::fromSkeleton(normalized, status).locale(locale);
|
||||
LocalizedNumberFormatter l3 = NumberFormatter::forSkeleton(normalized, status).locale(locale);
|
||||
for (int32_t i = 0; i < 9; i++) {
|
||||
double d = inputs[i];
|
||||
UnicodeString actual3 = l3.formatDouble(d, status).toString();
|
||||
@ -2530,9 +2530,9 @@ void NumberFormatterApiTest::assertFormatSingle(const char16_t* umessage, const
|
||||
UnicodeString skeleton(TRUE, uskeleton, -1);
|
||||
// Only compare normalized skeletons: the tests need not provide the normalized forms.
|
||||
// Use the normalized form to construct the testing formatter to ensure no loss of info.
|
||||
UnicodeString normalized = NumberFormatter::fromSkeleton(skeleton, status).toSkeleton(status);
|
||||
UnicodeString normalized = NumberFormatter::forSkeleton(skeleton, status).toSkeleton(status);
|
||||
assertEquals(message + ": Skeleton:", normalized, f.toSkeleton(status));
|
||||
LocalizedNumberFormatter l3 = NumberFormatter::fromSkeleton(normalized, status).locale(locale);
|
||||
LocalizedNumberFormatter l3 = NumberFormatter::forSkeleton(normalized, status).locale(locale);
|
||||
UnicodeString actual3 = l3.formatDouble(input, status).toString();
|
||||
assertEquals(message + ": Skeleton Path: '" + normalized + "': " + input, expected, actual3);
|
||||
} else {
|
||||
|
@ -106,7 +106,7 @@ void NumberSkeletonTest::validTokens() {
|
||||
for (auto& cas : cases) {
|
||||
UnicodeString skeletonString(cas);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
NumberFormatter::fromSkeleton(skeletonString, status);
|
||||
NumberFormatter::forSkeleton(skeletonString, status);
|
||||
assertSuccess(skeletonString, status);
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ void NumberSkeletonTest::stemsRequiringOption() {
|
||||
for (auto& suffix : suffixes) {
|
||||
UnicodeString skeletonString = UnicodeString(stem) + suffix;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
NumberFormatter::fromSkeleton(skeletonString, status);
|
||||
NumberFormatter::forSkeleton(skeletonString, status);
|
||||
assertEquals(skeletonString, U_NUMBER_SKELETON_SYNTAX_ERROR, status);
|
||||
}
|
||||
}
|
||||
@ -220,7 +220,7 @@ void NumberSkeletonTest::defaultTokens() {
|
||||
for (auto& cas : cases) {
|
||||
UnicodeString skeletonString(cas);
|
||||
status.setScope(skeletonString);
|
||||
UnicodeString normalized = NumberFormatter::fromSkeleton(
|
||||
UnicodeString normalized = NumberFormatter::forSkeleton(
|
||||
skeletonString, status).toSkeleton(status);
|
||||
// Skeleton should become empty when normalized
|
||||
assertEquals(skeletonString, u"", normalized);
|
||||
@ -242,7 +242,7 @@ void NumberSkeletonTest::flexibleSeparators() {
|
||||
UnicodeString skeletonString(cas.skeleton);
|
||||
UnicodeString expected(cas.expected);
|
||||
status.setScope(skeletonString);
|
||||
UnicodeString actual = NumberFormatter::fromSkeleton(skeletonString, status).locale("en")
|
||||
UnicodeString actual = NumberFormatter::forSkeleton(skeletonString, status).locale("en")
|
||||
.formatDouble(5142.3, status)
|
||||
.toString();
|
||||
assertEquals(skeletonString, expected, actual);
|
||||
@ -254,7 +254,7 @@ void NumberSkeletonTest::expectedErrorSkeleton(const char16_t** cases, int32_t c
|
||||
for (int32_t i = 0; i < casesLen; i++) {
|
||||
UnicodeString skeletonString(cases[i]);
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
NumberFormatter::fromSkeleton(skeletonString, status);
|
||||
NumberFormatter::forSkeleton(skeletonString, status);
|
||||
assertEquals(skeletonString, U_NUMBER_SKELETON_SYNTAX_ERROR, status);
|
||||
}
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ public class LocalizedNumberFormatterAsFormat extends Format {
|
||||
}
|
||||
|
||||
private Object readResolve() throws ObjectStreamException {
|
||||
return NumberFormatter.fromSkeleton(skeleton)
|
||||
return NumberFormatter.forSkeleton(skeleton)
|
||||
.locale(ULocale.forLanguageTag(languageTag))
|
||||
.toFormat();
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ public final class NumberFormatter {
|
||||
* @draft ICU 62
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
public static UnlocalizedNumberFormatter fromSkeleton(String skeleton) {
|
||||
public static UnlocalizedNumberFormatter forSkeleton(String skeleton) {
|
||||
return NumberSkeletonImpl.getOrCreate(skeleton);
|
||||
}
|
||||
|
||||
|
@ -2211,7 +2211,7 @@ public class MessageFormat extends UFormat {
|
||||
for (; PatternProps.isWhiteSpace(style.charAt(i)); i++);
|
||||
if (style.regionMatches(i, "::", 0, 2)) {
|
||||
// Skeleton
|
||||
newFormat = NumberFormatter.fromSkeleton(style.substring(i + 2)).locale(ulocale).toFormat();
|
||||
newFormat = NumberFormatter.forSkeleton(style.substring(i + 2)).locale(ulocale).toFormat();
|
||||
} else {
|
||||
// Pattern
|
||||
newFormat = new DecimalFormat(style, new DecimalFormatSymbols(ulocale));
|
||||
|
@ -2127,8 +2127,8 @@ public class NumberFormatterApiTest {
|
||||
public Object[] getTestObjects() {
|
||||
return new Object[] {
|
||||
NumberFormatter.withLocale(ULocale.FRENCH).toFormat(),
|
||||
NumberFormatter.fromSkeleton("percent").locale(ULocale.JAPANESE).toFormat(),
|
||||
NumberFormatter.fromSkeleton("scientific .000").locale(ULocale.ENGLISH).toFormat() };
|
||||
NumberFormatter.forSkeleton("percent").locale(ULocale.JAPANESE).toFormat(),
|
||||
NumberFormatter.forSkeleton("scientific .000").locale(ULocale.ENGLISH).toFormat() };
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -2336,9 +2336,9 @@ public class NumberFormatterApiTest {
|
||||
if (skeleton != null) { // if null, skeleton is declared as undefined.
|
||||
// Only compare normalized skeletons: the tests need not provide the normalized forms.
|
||||
// Use the normalized form to construct the testing formatter to guarantee no loss of info.
|
||||
String normalized = NumberFormatter.fromSkeleton(skeleton).toSkeleton();
|
||||
String normalized = NumberFormatter.forSkeleton(skeleton).toSkeleton();
|
||||
assertEquals(message + ": Skeleton:", normalized, f.toSkeleton());
|
||||
LocalizedNumberFormatter l3 = NumberFormatter.fromSkeleton(normalized).locale(locale);
|
||||
LocalizedNumberFormatter l3 = NumberFormatter.forSkeleton(normalized).locale(locale);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
double d = inputs[i];
|
||||
String actual3 = l3.format(d).toString();
|
||||
@ -2365,9 +2365,9 @@ public class NumberFormatterApiTest {
|
||||
if (skeleton != null) { // if null, skeleton is declared as undefined.
|
||||
// Only compare normalized skeletons: the tests need not provide the normalized forms.
|
||||
// Use the normalized form to construct the testing formatter to ensure no loss of info.
|
||||
String normalized = NumberFormatter.fromSkeleton(skeleton).toSkeleton();
|
||||
String normalized = NumberFormatter.forSkeleton(skeleton).toSkeleton();
|
||||
assertEquals(message + ": Skeleton:", normalized, f.toSkeleton());
|
||||
LocalizedNumberFormatter l3 = NumberFormatter.fromSkeleton(normalized).locale(locale);
|
||||
LocalizedNumberFormatter l3 = NumberFormatter.forSkeleton(normalized).locale(locale);
|
||||
String actual3 = l3.format(input).toString();
|
||||
assertEquals(message + ": Skeleton Path: " + input, expected, actual3);
|
||||
} else {
|
||||
@ -2391,9 +2391,9 @@ public class NumberFormatterApiTest {
|
||||
if (skeleton != null) { // if null, skeleton is declared as undefined.
|
||||
// Only compare normalized skeletons: the tests need not provide the normalized forms.
|
||||
// Use the normalized form to construct the testing formatter to ensure no loss of info.
|
||||
String normalized = NumberFormatter.fromSkeleton(skeleton).toSkeleton();
|
||||
String normalized = NumberFormatter.forSkeleton(skeleton).toSkeleton();
|
||||
assertEquals(message + ": Skeleton:", normalized, f.toSkeleton());
|
||||
LocalizedNumberFormatter l3 = NumberFormatter.fromSkeleton(normalized).locale(locale);
|
||||
LocalizedNumberFormatter l3 = NumberFormatter.forSkeleton(normalized).locale(locale);
|
||||
String actual3 = l3.format(input).toString();
|
||||
assertEquals(message + ": Skeleton Path: " + input, expected, actual3);
|
||||
} else {
|
||||
|
@ -96,7 +96,7 @@ public class NumberSkeletonTest {
|
||||
|
||||
for (String cas : cases) {
|
||||
try {
|
||||
NumberFormatter.fromSkeleton(cas);
|
||||
NumberFormatter.forSkeleton(cas);
|
||||
} catch (SkeletonSyntaxException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
@ -139,7 +139,7 @@ public class NumberSkeletonTest {
|
||||
|
||||
for (String cas : cases) {
|
||||
try {
|
||||
NumberFormatter.fromSkeleton(cas);
|
||||
NumberFormatter.forSkeleton(cas);
|
||||
fail(cas);
|
||||
} catch (SkeletonSyntaxException expected) {
|
||||
assertTrue(expected.getMessage(), expected.getMessage().contains("Invalid"));
|
||||
@ -160,7 +160,7 @@ public class NumberSkeletonTest {
|
||||
|
||||
for (String cas : cases) {
|
||||
try {
|
||||
NumberFormatter.fromSkeleton(cas);
|
||||
NumberFormatter.forSkeleton(cas);
|
||||
fail(cas);
|
||||
} catch (SkeletonSyntaxException expected) {
|
||||
assertTrue(expected.getMessage(), expected.getMessage().contains("Unknown"));
|
||||
@ -179,7 +179,7 @@ public class NumberSkeletonTest {
|
||||
|
||||
for (String cas : cases) {
|
||||
try {
|
||||
NumberFormatter.fromSkeleton(cas);
|
||||
NumberFormatter.forSkeleton(cas);
|
||||
fail(cas);
|
||||
} catch (SkeletonSyntaxException expected) {
|
||||
assertTrue(expected.getMessage(), expected.getMessage().contains("Unexpected"));
|
||||
@ -200,7 +200,7 @@ public class NumberSkeletonTest {
|
||||
|
||||
for (String cas : cases) {
|
||||
try {
|
||||
NumberFormatter.fromSkeleton(cas);
|
||||
NumberFormatter.forSkeleton(cas);
|
||||
fail(cas);
|
||||
} catch (SkeletonSyntaxException expected) {
|
||||
assertTrue(expected.getMessage(), expected.getMessage().contains("Duplicated"));
|
||||
@ -224,7 +224,7 @@ public class NumberSkeletonTest {
|
||||
for (String suffix : suffixes) {
|
||||
String skeletonString = stem + suffix;
|
||||
try {
|
||||
NumberFormatter.fromSkeleton(skeletonString);
|
||||
NumberFormatter.forSkeleton(skeletonString);
|
||||
fail(skeletonString);
|
||||
} catch (SkeletonSyntaxException expected) {
|
||||
// Success
|
||||
@ -245,7 +245,7 @@ public class NumberSkeletonTest {
|
||||
"decimal-auto" };
|
||||
|
||||
for (String skeleton : cases) {
|
||||
String normalized = NumberFormatter.fromSkeleton(skeleton).toSkeleton();
|
||||
String normalized = NumberFormatter.forSkeleton(skeleton).toSkeleton();
|
||||
assertEquals("Skeleton should become empty when normalized: " + skeleton, "", normalized);
|
||||
}
|
||||
}
|
||||
@ -261,7 +261,7 @@ public class NumberSkeletonTest {
|
||||
for (String[] cas : cases) {
|
||||
String skeleton = cas[0];
|
||||
String expected = cas[1];
|
||||
String actual = NumberFormatter.fromSkeleton(skeleton).locale(ULocale.ENGLISH).format(5142.3)
|
||||
String actual = NumberFormatter.forSkeleton(skeleton).locale(ULocale.ENGLISH).format(5142.3)
|
||||
.toString();
|
||||
assertEquals(skeleton, expected, actual);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user