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
This commit is contained in:
parent
e596d86ca0
commit
95dd352eca
@ -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/>")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user