ICU-3004 Test for some Turkish case conversion errors.

X-SVN-Rev: 17003
This commit is contained in:
George Rhoten 2004-12-22 19:25:19 +00:00
parent 61d7b4dc47
commit 1b9f1f50a6
2 changed files with 38 additions and 1 deletions

View file

@ -51,7 +51,8 @@ TestMessageFormat::runIndexedTest(int32_t index, UBool exec,
TESTCASE(15,testAdopt);
TESTCASE(16,testCopyConstructor2);
TESTCASE(17,TestUnlimitedArgsAndSubformats);
TESTCASE(18,TestRBNF);
TESTCASE(18,TestRBNF);
TESTCASE(19,TestTurkishCasing);
default: name = ""; break;
}
}
@ -402,6 +403,41 @@ void TestMessageFormat::testStaticFormat()
}
}
/* When the default locale is tr, make sure that the pattern can still be parsed. */
void TestMessageFormat::TestTurkishCasing()
{
UErrorCode err = U_ZERO_ERROR;
Locale saveDefaultLocale;
Locale::setDefault( Locale("tr"), err );
Formattable arguments[] = {
(int32_t)7,
Formattable(UDate(8.71068e+011), Formattable::kIsDate),
"a disturbance in the Force"
};
UnicodeString result;
result = MessageFormat::format(
"At {1,TIME} on {1,DATE,SHORT}, there was {2} on planet {0,NUMBER,INTEGER}.",
arguments,
3,
result,
err);
if (U_FAILURE(err)) {
errln("TestTurkishCasing #1 with error code %s", u_errorName(err));
return;
}
const UnicodeString expected(
"At 12:20:00 on 08.08.1997, there was a disturbance in the Force on planet 7.", "");
if (result != expected) {
errln("TestTurkishCasing failed on test");
errln( UnicodeString(" Result: ") + result );
errln( UnicodeString(" Expected: ") + expected );
}
Locale::setDefault( saveDefaultLocale, err );
}
void TestMessageFormat::testSimpleFormat(/* char* par */)
{

View file

@ -85,6 +85,7 @@ public:
void testFormat(void);
void testParse(void);
void testAdopt(void);
void TestTurkishCasing(void);
private:
};