ICU-8892 merge of #9191 for 4.8x

X-SVN-Rev: 31604
This commit is contained in:
Steven R. Loomis 2012-03-08 19:39:58 +00:00
parent 6c7f41c17c
commit dfa0d688f4
3 changed files with 35 additions and 3 deletions

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 1997-2011, International Business Machines Corporation and *
* Copyright (C) 1997-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*
@ -760,6 +760,8 @@ Calendar::operator=(const Calendar &right)
fWeekendCease = right.fWeekendCease;
fWeekendCeaseMillis = right.fWeekendCeaseMillis;
fNextStamp = right.fNextStamp;
uprv_strcpy(validLocale, right.validLocale);
uprv_strcpy(actualLocale, right.actualLocale);
}
return *this;

View file

@ -1,6 +1,6 @@
/************************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2011, International Business Machines Corporation
* Copyright (c) 1997-2012, International Business Machines Corporation
* and others. All Rights Reserved.
************************************************************************/
@ -18,9 +18,15 @@
#include "unicode/udat.h"
#include "unicode/ustring.h"
#include "cstring.h"
#include "unicode/localpointer.h"
#define mkcstr(U) u_austrcpy(calloc(8, u_strlen(U) + 1), U)
#define TEST_CHECK_STATUS {if (U_FAILURE(status)) {errln("%s:%d: Test failure. status=%s", \
__FILE__, __LINE__, u_errorName(status)); return;}}
#define TEST_ASSERT(expr) {if ((expr)==FALSE) {errln("%s:%d: Test failure \n", __FILE__, __LINE__);};}
// *****************************************************************************
// class CalendarTest
// *****************************************************************************
@ -244,6 +250,13 @@ void CalendarTest::runIndexedTest( int32_t index, UBool exec, const char* &name,
TestISO8601();
}
break;
case 27:
name = "TestCloneLocale";
if(exec) {
logln("TestCloneLocale---"); logln("");
TestCloneLocale();
}
break;
default: name = ""; break;
}
}
@ -2257,6 +2270,21 @@ void CalendarTest::TestISO8601() {
}
void CalendarTest::TestCloneLocale(void) {
UErrorCode status = U_ZERO_ERROR;
LocalPointer<Calendar> cal(Calendar::createInstance(TimeZone::getGMT()->clone(),
Locale::createFromName("en"), status));
TEST_CHECK_STATUS;
Locale l0 = cal->getLocale(ULOC_VALID_LOCALE, status);
TEST_CHECK_STATUS;
LocalPointer<Calendar> cal2(cal->clone());
Locale l = cal2->getLocale(ULOC_VALID_LOCALE, status);
if(l0!=l) {
errln("Error: cloned locale %s != original locale %s, status %s\n", l0.getName(), l.getName(), u_errorName(status));
}
TEST_CHECK_STATUS;
}
#endif /* #if !UCONFIG_NO_FORMATTING */
//eof

View file

@ -1,5 +1,5 @@
/***********************************************************************
* Copyright (c) 1997-2011, International Business Machines Corporation
* Copyright (c) 1997-2012, International Business Machines Corporation
* and others. All Rights Reserved.
***********************************************************************/
@ -228,6 +228,8 @@ public: // package
* Test the ISO8601 calendar type
*/
void TestISO8601(void);
void TestCloneLocale(void);
};
#endif /* #if !UCONFIG_NO_FORMATTING */