summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-06-02 17:59:37 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-06-02 17:59:37 +0000
commit95dd352ecac49b2daf909dda1a8a93f9075fa44c (patch)
treee9539e21900d08b44289a8c6234ee83cdf1946ec /tests
parente596d86ca0e45508a0c82ae18495ed19de360d8d (diff)
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
Diffstat (limited to 'tests')
-rw-r--r--tests/test_document.cpp13
1 files changed, 12 insertions, 1 deletions
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, "<node/>")
TEST_XML(document_save_file, "<node/>")
{
+#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("<?xml version=\"1.0\"?><node />"));
- unlink(path);
+ CHECK(unlink(path) == 0);
+
+#ifdef __unix
+ CHECK(close(fd) == 0);
+#endif
}
TEST_XML(document_save_file_error, "<node/>")