From 7c5b88b134b0141c3ffda62534572a89d5a9640e Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Fri, 22 Mar 2013 20:05:40 +0000 Subject: 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 llvm-svn: 177755 --- .../fstreams/ofstream.members/open_string.pass.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp') diff --git a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp index b33114d9725..d54aa1824ab 100644 --- a/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp +++ b/libcxx/test/input.output/file.streams/fstreams/ofstream.members/open_string.pass.cpp @@ -16,43 +16,43 @@ #include #include +#include "platform_support.h" int main() { - char temp[L_tmpnam]; - tmpnam(temp); + std::string temp = get_temp_file_name(); { std::ofstream fs; assert(!fs.is_open()); char c = 'a'; fs << c; assert(fs.fail()); - fs.open(std::string(temp)); + fs.open(temp); assert(fs.is_open()); fs << c; } { - std::ifstream fs(temp); + std::ifstream fs(temp.c_str()); char c = 0; fs >> c; assert(c == 'a'); } - remove(temp); + std::remove(temp.c_str()); { std::wofstream fs; assert(!fs.is_open()); wchar_t c = L'a'; fs << c; assert(fs.fail()); - fs.open(std::string(temp)); + fs.open(temp); assert(fs.is_open()); fs << c; } { - std::wifstream fs(temp); + std::wifstream fs(temp.c_str()); wchar_t c = 0; fs >> c; assert(c == L'a'); } - remove(temp); + std::remove(temp.c_str()); } -- cgit v1.2.3