2003-05-15 16:28:58 +00:00
|
|
|
/********************************************************************
|
|
|
|
* COPYRIGHT:
|
2004-05-14 22:06:34 +00:00
|
|
|
* Copyright (c) 1997-2004, International Business Machines Corporation and
|
2003-05-15 16:28:58 +00:00
|
|
|
* others. All Rights Reserved.
|
|
|
|
********************************************************************/
|
|
|
|
|
|
|
|
#include "unicode/ucnv.h"
|
|
|
|
#include "unicode/ucnv_err.h"
|
|
|
|
|
|
|
|
#include "cintltst.h"
|
|
|
|
#include "ustr_imp.h"
|
2004-05-14 22:06:34 +00:00
|
|
|
void TestDefaultConverterError(void); /* keep gcc happy */
|
2003-05-15 16:28:58 +00:00
|
|
|
|
|
|
|
|
2004-05-14 22:06:34 +00:00
|
|
|
/* This makes sure that a converter isn't leaked when an error is passed to
|
|
|
|
u_getDefaultConverter */
|
|
|
|
void TestDefaultConverterError(void) {
|
2003-05-15 16:28:58 +00:00
|
|
|
UErrorCode err = U_ZERO_ERROR;
|
|
|
|
|
2004-05-14 22:06:34 +00:00
|
|
|
/* Remove the default converter */
|
|
|
|
ucnv_close(u_getDefaultConverter(&err));
|
2003-05-15 16:28:58 +00:00
|
|
|
|
|
|
|
if (U_FAILURE(err)) {
|
2004-05-14 22:06:34 +00:00
|
|
|
log_err("Didn't expect a failure yet %s\n", myErrorName(err));
|
|
|
|
return;
|
2003-05-15 16:28:58 +00:00
|
|
|
}
|
|
|
|
|
2004-05-14 22:06:34 +00:00
|
|
|
/* Set to any radom error state */
|
|
|
|
err = U_FILE_ACCESS_ERROR;
|
|
|
|
if (u_getDefaultConverter(&err) != NULL) {
|
|
|
|
log_err("Didn't expect to get a converter on a failure\n");
|
2003-05-15 16:28:58 +00:00
|
|
|
}
|
2003-05-15 17:37:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|