]> granicus.if.org Git - icu/commitdiff
ICU-9804 Add unit test for fix to ures_getByKeyWithFallback.
authorTravis Keep <keep94@gmail.com>
Tue, 18 Dec 2012 17:59:25 +0000 (17:59 +0000)
committerTravis Keep <keep94@gmail.com>
Tue, 18 Dec 2012 17:59:25 +0000 (17:59 +0000)
X-SVN-Rev: 32986

icu4c/source/test/cintltst/creststn.c
icu4c/source/test/cintltst/creststn.h

index 2cc2857a99ffe665e7b473d03e355241e468ded9..8b1e33ca08c5c5ffcfa89c9cc4d2012bc1fa62e8 100644 (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.
index f6becdb979ca4ed117b36eeab1036a42e2579673..86810be788431f7aaee81c37c188093f84d34905 100644 (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);