ICU-9804 Add unit test for fix to ures_getByKeyWithFallback.

X-SVN-Rev: 32986
This commit is contained in:
Travis Keep 2012-12-18 17:59:25 +00:00
parent 623787fa35
commit fc3787c545
2 changed files with 28 additions and 1 deletions

View file

@ -202,6 +202,7 @@ void addNEWResourceBundleTest(TestNode** root)
addTest(root, &TestDecodedBundle, "tsutil/creststn/TestDecodedBundle");
addTest(root, &TestResourceLevelAliasing, "tsutil/creststn/TestResourceLevelAliasing");
addTest(root, &TestDirectAccess, "tsutil/creststn/TestDirectAccess");
addTest(root, &TestTicket9804, "tsutil/creststn/TestTicket9804");
addTest(root, &TestXPath, "tsutil/creststn/TestXPath");
addTest(root, &TestCLDRStyleAliases, "tsutil/creststn/TestCLDRStyleAliases");
addTest(root, &TestFallbackCodes, "tsutil/creststn/TestFallbackCodes");
@ -2429,6 +2430,30 @@ static void TestDirectAccess(void) {
ures_close(t);
}
static void TestTicket9804(void) {
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *t = NULL;
t = ures_open(NULL, "he", &status);
t = ures_getByKeyWithFallback(t, "calendar/islamic-civil/DateTime", t, &status);
if(U_SUCCESS(status)) {
log_err("This resource does not exist. How did it get here?\n");
}
status = U_ZERO_ERROR;
ures_close(t);
t = ures_open(NULL, "he", &status);
t = ures_getByKeyWithFallback(t, "calendar/islamic-civil/eras", t, &status);
if(U_FAILURE(status)) {
log_err_status(status, "Didn't get Eras. I know they are there!\n");
} else {
const char *locale = ures_getLocaleByType(t, ULOC_ACTUAL_LOCALE, &status);
if (uprv_strcmp("he", locale) != 0) {
log_err("Eras should be in the 'he' locale, but was in: %s", locale);
}
}
status = U_ZERO_ERROR;
ures_close(t);
}
static void TestJB3763(void) {
/* Nasty bug prevented using parent as fill-in, since it would
* stomp the path information.

View file

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2006, International Business Machines Corporation and
* Copyright (c) 1997-2012, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/***************************************************************************
@ -63,6 +63,8 @@ static void TestEmptyBundle(void);
static void TestDirectAccess(void);
static void TestTicket9804(void);
static void TestResourceLevelAliasing(void);
static void TestErrorCodes(void);