ICU-3499 Verify that the test file can be removed during testing.

X-SVN-Rev: 14970
This commit is contained in:
George Rhoten 2004-04-14 23:41:00 +00:00
parent d3852a94e8
commit d1bc58f6a0
4 changed files with 21 additions and 1 deletions

View File

@ -104,6 +104,11 @@ u_fopen(const char *filename,
if (result) {
result->fOwnFile = TRUE;
}
else {
/* Something bad happened.
Maybe the converter couldn't be opened. */
fclose(systemFile);
}
return result;
}

View File

@ -20,7 +20,7 @@
#include <string.h>
static char STANDARD_TEST_FILE[] = "iotest-c.txt";
const char STANDARD_TEST_FILE[] = "iotest-c.txt";
static void TestFileFromICU(UFILE *myFile) {

View File

@ -372,6 +372,20 @@ int main(int argc, char* argv[])
addAllTests(&root);
nerrors = processArgs(root, argc, argv);
#if 1
{
FILE* fileToRemove = fopen(STANDARD_TEST_FILE, "r");
/* This should delete any temporary files. */
if (fileToRemove) {
fclose(fileToRemove);
if (remove(STANDARD_TEST_FILE) != 0) {
/* Maybe someone didn't close the file correctly. */
fprintf(stderr, "FAIL: Could not delete %s\n", STANDARD_TEST_FILE);
}
}
}
#endif
cleanUpTestTree(root);
u_cleanup();
return nerrors;

View File

@ -26,6 +26,7 @@ addFileTest(TestNode** root);
U_CDECL_BEGIN
extern const UChar NEW_LINE[];
extern const char STANDARD_TEST_FILE[];
U_CDECL_END
#define STANDARD_TEST_NUM_RANGE 1000