ICU-20807 BRS65: Environment test failure in cintltst-timezone
The test fails for "America/Argentina/ComodRivadavia", which has length of 32, the same as the buffer. The results in the string being not terminated with a NUL. This increases the buffer size used by the test, and also checks for the string not terminated warning.
This commit is contained in:
parent
28196f6245
commit
b851c53b91
@ -114,7 +114,8 @@ static void TestCalendar()
|
|||||||
UChar *result = 0;
|
UChar *result = 0;
|
||||||
int32_t resultlength, resultlengthneeded;
|
int32_t resultlength, resultlengthneeded;
|
||||||
char tempMsgBuf[1024]; // u_austrcpy() of some formatted dates & times.
|
char tempMsgBuf[1024]; // u_austrcpy() of some formatted dates & times.
|
||||||
UChar zone1[32], zone2[32];
|
char tempMsgBuf2[256]; // u_austrcpy() of some formatted dates & times.
|
||||||
|
UChar zone1[64], zone2[64];
|
||||||
const char *tzver = 0;
|
const char *tzver = 0;
|
||||||
UChar canonicalID[64];
|
UChar canonicalID[64];
|
||||||
UBool isSystemID = FALSE;
|
UBool isSystemID = FALSE;
|
||||||
@ -231,7 +232,7 @@ static void TestCalendar()
|
|||||||
/*Test ucal_set/getDefaultTimeZone and ucal_getHostTimeZone */
|
/*Test ucal_set/getDefaultTimeZone and ucal_getHostTimeZone */
|
||||||
status = U_ZERO_ERROR;
|
status = U_ZERO_ERROR;
|
||||||
i = ucal_getDefaultTimeZone(zone1, UPRV_LENGTHOF(zone1), &status);
|
i = ucal_getDefaultTimeZone(zone1, UPRV_LENGTHOF(zone1), &status);
|
||||||
if (U_FAILURE(status)) {
|
if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
|
||||||
log_err("FAIL: ucal_getDefaultTimeZone() => %s\n",
|
log_err("FAIL: ucal_getDefaultTimeZone() => %s\n",
|
||||||
u_errorName(status));
|
u_errorName(status));
|
||||||
} else {
|
} else {
|
||||||
@ -250,11 +251,12 @@ static void TestCalendar()
|
|||||||
} else {
|
} else {
|
||||||
// Redetect the host timezone, it should be the same as zone1 even though ICU's default timezone has been changed.
|
// Redetect the host timezone, it should be the same as zone1 even though ICU's default timezone has been changed.
|
||||||
i = ucal_getHostTimeZone(zone2, UPRV_LENGTHOF(zone2), &status);
|
i = ucal_getHostTimeZone(zone2, UPRV_LENGTHOF(zone2), &status);
|
||||||
if (U_FAILURE(status)) {
|
if (U_FAILURE(status) || status == U_STRING_NOT_TERMINATED_WARNING) {
|
||||||
log_err("FAIL: ucal_getHostTimeZone() => %s\n", u_errorName(status));
|
log_err("FAIL: ucal_getHostTimeZone() => %s\n", u_errorName(status));
|
||||||
} else {
|
} else {
|
||||||
if (u_strcmp(zone1, zone2) != 0) {
|
if (u_strcmp(zone1, zone2) != 0) {
|
||||||
log_err("FAIL: ucal_getHostTimeZone() should give the same host timezone even if the default changed.\n");
|
log_err("FAIL: ucal_getHostTimeZone() should give the same host timezone even if the default changed. (Got '%s', Expected '%s').\n",
|
||||||
|
u_austrcpy(tempMsgBuf, zone2), u_austrcpy(tempMsgBuf2, zone1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user