mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-20 20:19:32 +00:00
ICU-13581 Make tests work, not crash, when run without ICU data
X-SVN-Rev: 41073
This commit is contained in:
parent
4b90830e20
commit
b5e8865ff2
3 changed files with 24 additions and 7 deletions
|
@ -736,7 +736,11 @@ void AlphabeticIndexTest::testHasBuckets() {
|
|||
void AlphabeticIndexTest::checkHasBuckets(const Locale &locale, UScriptCode script) {
|
||||
IcuTestErrorCode errorCode(*this, "checkHasBuckets");
|
||||
AlphabeticIndex aindex(locale, errorCode);
|
||||
LocalPointer<AlphabeticIndex::ImmutableIndex> index(aindex.buildImmutableIndex(errorCode));
|
||||
LocalPointer<AlphabeticIndex::ImmutableIndex> index(aindex.buildImmutableIndex(errorCode), errorCode);
|
||||
if (U_FAILURE(errorCode)) {
|
||||
dataerrln("%s %d Error in index creation", __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
UnicodeString loc = locale.getName();
|
||||
assertTrue(loc + u" at least 3 buckets", index->getBucketCount() >= 3);
|
||||
const AlphabeticIndex::Bucket *bucket = index->getBucket(1);
|
||||
|
|
|
@ -106,8 +106,13 @@ void PatternModifierTest::testPatternWithNoPlaceholder() {
|
|||
nsb.append(u"x123y", UNUM_FIELD_COUNT, status);
|
||||
assertSuccess("Spot 5", status);
|
||||
MicroProps micros;
|
||||
LocalPointer<ImmutablePatternModifier> imod(mod.createImmutable(status));
|
||||
assertSuccess("Spot 6", status);
|
||||
LocalPointer<ImmutablePatternModifier> imod(mod.createImmutable(status), status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("%s %d Error in ImmutablePatternModifier creation",
|
||||
__FILE__, __LINE__);
|
||||
assertSuccess("Spot 6", status);
|
||||
return;
|
||||
}
|
||||
DecimalQuantity quantity;
|
||||
imod->applyToMicros(micros, quantity);
|
||||
micros.modMiddle->apply(nsb, 1, 4, status);
|
||||
|
|
|
@ -8934,8 +8934,12 @@ void NumberFormatTest::Test11035_FormatCurrencyAmount() {
|
|||
// Test two ways to set a currency via API
|
||||
|
||||
Locale loc1 = Locale("pt_PT");
|
||||
LocalPointer<NumberFormat> fmt1(NumberFormat::createCurrencyInstance(loc1, status));
|
||||
assertSuccess("Creating fmt1", status);
|
||||
LocalPointer<NumberFormat> fmt1(NumberFormat::createCurrencyInstance("loc1", status),
|
||||
status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("%s %d NumberFormat instance fmt1 is null", __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
fmt1->setCurrency(u"PTE", status);
|
||||
assertSuccess("Setting currency on fmt1", status);
|
||||
UnicodeString actualSetCurrency;
|
||||
|
@ -8947,7 +8951,7 @@ void NumberFormatTest::Test11035_FormatCurrencyAmount() {
|
|||
UnicodeString actualLocaleString;
|
||||
fmt2->format(amount, actualLocaleString);
|
||||
|
||||
// TODO: The following test fill fail until DecimalFormat wraps NumberFormatter.
|
||||
// TODO: The following test will fail until DecimalFormat wraps NumberFormatter.
|
||||
if (!logKnownIssue("13574")) {
|
||||
assertEquals("Custom Currency Pattern, Set Currency", expected, actualSetCurrency);
|
||||
}
|
||||
|
@ -8955,7 +8959,11 @@ void NumberFormatTest::Test11035_FormatCurrencyAmount() {
|
|||
|
||||
void NumberFormatTest::Test11318_DoubleConversion() {
|
||||
IcuTestErrorCode status(*this, "Test11318_DoubleConversion");
|
||||
LocalPointer<NumberFormat> nf(NumberFormat::createInstance("en", status));
|
||||
LocalPointer<NumberFormat> nf(NumberFormat::createInstance("en", status), status);
|
||||
if (U_FAILURE(status)) {
|
||||
dataerrln("%s %d Error in NumberFormat instance creation", __FILE__, __LINE__);
|
||||
return;
|
||||
}
|
||||
nf->setMaximumFractionDigits(40);
|
||||
nf->setMaximumIntegerDigits(40);
|
||||
UnicodeString appendTo;
|
||||
|
|
Loading…
Add table
Reference in a new issue