Test cleanup with respect to use of deprecated tmpnam function. Also Windows port for these tests to use _tempnam. The bulk of this patch was donated anonymously. I've tested it on OS X and accept responsibility for it. If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know. Should be easy to fix in test/support/platform_support.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177755 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -16,27 +16,27 @@
|
||||
|
||||
#include <fstream>
|
||||
#include <cassert>
|
||||
#include "platform_support.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
char temp[L_tmpnam];
|
||||
tmpnam(temp);
|
||||
std::string temp = get_temp_file_name();
|
||||
{
|
||||
std::fstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open(temp, std::ios_base::out);
|
||||
fs.open(temp.c_str(), std::ios_base::out);
|
||||
assert(fs.is_open());
|
||||
fs.close();
|
||||
assert(!fs.is_open());
|
||||
}
|
||||
remove(temp);
|
||||
std::remove(temp.c_str());
|
||||
{
|
||||
std::wfstream fs;
|
||||
assert(!fs.is_open());
|
||||
fs.open(temp, std::ios_base::out);
|
||||
fs.open(temp.c_str(), std::ios_base::out);
|
||||
assert(fs.is_open());
|
||||
fs.close();
|
||||
assert(!fs.is_open());
|
||||
}
|
||||
remove(temp);
|
||||
std::remove(temp.c_str());
|
||||
}
|
||||
|
Reference in New Issue
Block a user