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)); }