From 95dd352ecac49b2daf909dda1a8a93f9075fa44c Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Wed, 2 Jun 2010 17:59:37 +0000 Subject: tests: Temporary file name is obtained via mkstemp on Unix systems git-svn-id: http://pugixml.googlecode.com/svn/trunk@499 99668b35-9821-0410-8761-19e4c4f06640 --- tests/test_document.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests') 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, "") -- cgit v1.2.3