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:
Howard Hinnant
2013-03-22 20:05:40 +00:00
parent 9b145da078
commit 06d8bf6ce2
25 changed files with 205 additions and 184 deletions

View File

@@ -16,14 +16,14 @@
#include <fstream>
#include <cassert>
#include "platform_support.h"
int main()
{
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
char temp[L_tmpnam];
tmpnam(temp);
std::string temp = get_temp_file_name();
{
std::fstream fso(temp, std::ios_base::in | std::ios_base::out
std::fstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::fstream fs;
fs = move(fso);
@@ -33,9 +33,9 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove(temp.c_str());
{
std::wfstream fso(temp, std::ios_base::in | std::ios_base::out
std::wfstream fso(temp.c_str(), std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
std::wfstream fs;
fs = move(fso);
@@ -45,6 +45,6 @@ int main()
fs >> x;
assert(x == 3.25);
}
std::remove(temp);
std::remove(temp.c_str());
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}