summaryrefslogtreecommitdiff
path: root/devel/icu4/files/patch-intltest
blob: 61b6baec5887801b18619ca929b28d816e3641e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
This fixes the test code as addressing the problem(s) documented in
FreeBSD's

	http://www.freebsd.org/cgi/query-pr.cgi?pr=102629

and ICU's

	http://bugs.icu-project.org/cgi-bin/icu-bugs?findid=5366

--- test/intltest/restsnew.cpp	Tue Dec 27 17:21:28 2005
+++ test/intltest/restsnew.cpp	Tue Nov  7 11:35:57 2006
@@ -1,5 +1,5 @@
 /********************************************************************
  * COPYRIGHT: 
- * Copyright (c) 1997-2005, International Business Machines Corporation and
+ * Copyright (c) 1997-2006, International Business Machines Corporation and
  * others. All Rights Reserved.
  ********************************************************************/
@@ -35,9 +35,9 @@
 //***************************************************************************************
 
-#define CONFIRM_EQ(actual,expected) if ((expected)==(actual)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (actual) + (UnicodeString)" instead of " + (expected) + (UnicodeString)"\n"); }
-#define CONFIRM_GE(actual,expected) if ((actual)>=(expected)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (actual) + (UnicodeString)" instead of x >= " + (expected) + (UnicodeString)"\n"); }
-#define CONFIRM_NE(actual,expected) if ((expected)!=(actual)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (actual) + (UnicodeString)" instead of x != " + (expected) + (UnicodeString)"\n"); }
+#define CONFIRM_EQ(actual,expected) if ((expected)==(actual)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (actual) + (UnicodeString)" instead of " + (expected)); }
+#define CONFIRM_GE(actual,expected) if ((actual)>=(expected)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (actual) + (UnicodeString)" instead of x >= " + (expected)); }
+#define CONFIRM_NE(actual,expected) if ((expected)!=(actual)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (actual) + (UnicodeString)" instead of x != " + (expected)); }
 
-#define CONFIRM_UErrorCode(actual,expected) if ((expected)==(actual)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (UnicodeString)u_errorName(actual) + (UnicodeString)" instead of " + (UnicodeString)u_errorName(expected) + (UnicodeString)"\n"); }
+#define CONFIRM_UErrorCode(actual,expected) if ((expected)==(actual)) { record_pass(); } else { record_fail(); errln(action + (UnicodeString)" returned " + (UnicodeString)u_errorName(actual) + (UnicodeString)" instead of " + (UnicodeString)u_errorName(expected)); }
 
 //***************************************************************************************
@@ -198,4 +198,12 @@
 NewResourceBundleTest::TestResourceBundles()
 {
+    UErrorCode status = U_ZERO_ERROR;
+    loadTestData(status);
+    if(U_FAILURE(status))
+    {
+        errln("Could not load testdata.dat %s " + UnicodeString(u_errorName(status)));
+        return;
+    }
+
     testTag("only_in_Root", TRUE, FALSE, FALSE);
     testTag("only_in_te", FALSE, TRUE, FALSE);
@@ -432,10 +440,16 @@
     logln("Testing ResourceBundle(UErrorCode)\n");
     ResourceBundle defaultresource(err);
+    ResourceBundle explicitdefaultresource(NULL, Locale::getDefault(), err);
     if(U_FAILURE(err)){
         errln("Construction of default resourcebundle failed");
         return;
     }
-    if(strcmp(defaultresource.getLocale().getName(), Locale::getDefault().getName()) != 0){
-        errln("Construction of default resourcebundle didn't take the defaultlocale\n");
+    // You can't compare the default locale to the resolved locale in the
+    // resource bundle due to aliasing, keywords in the default locale
+    // or the chance that the machine running these tests is using a locale
+    // that isn't available in ICU.
+    if(strcmp(defaultresource.getLocale().getName(), explicitdefaultresource.getLocale().getName()) != 0){
+        errln("Construction of default resourcebundle didn't take the defaultlocale. Expected %s Got %s err=%s\n",
+            explicitdefaultresource.getLocale().getName(), defaultresource.getLocale().getName(), u_errorName(err));
     }