diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 33f6df7..6dbc0fe 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -209,14 +209,25 @@ TEST_XML(document_save_declaration, "") TEST_XML(document_save_file, "") { +#ifdef __unix + char path[] = "/tmp/pugiXXXXXX"; + + int fd = mkstemp(path); + CHECK(fd != -1); +#else const char* path = tmpnam(0); +#endif CHECK(doc.save_file(path)); CHECK(doc.load_file(path, pugi::parse_default | pugi::parse_declaration)); CHECK_NODE(doc, STR("")); - unlink(path); + CHECK(unlink(path) == 0); + +#ifdef __unix + CHECK(close(fd) == 0); +#endif } TEST_XML(document_save_file_error, "")