summaryrefslogtreecommitdiffstats
path: root/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
diff options
context:
space:
mode:
authorHoward Hinnant <hhinnant@apple.com>2013-03-22 20:05:40 +0000
committerHoward Hinnant <hhinnant@apple.com>2013-03-22 20:05:40 +0000
commit7c5b88b134b0141c3ffda62534572a89d5a9640e (patch)
treec8e8b66f42f35f8d2249a4dc62dbcf9275bf688e /libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
parent7c8dbc12bb73c1d42307e784410a1d5383461732 (diff)
downloadbcm5719-llvm-7c5b88b134b0141c3ffda62534572a89d5a9640e.tar.gz
bcm5719-llvm-7c5b88b134b0141c3ffda62534572a89d5a9640e.zip
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
Diffstat (limited to 'libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp')
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
index a61a4e965d3..182f12c47d1 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_string.pass.cpp
@@ -16,15 +16,15 @@
#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(std::string(temp), std::ios_base::in | std::ios_base::out
+ fs.open(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
@@ -33,11 +33,11 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove(temp);
+ std::remove(temp.c_str());
{
std::wfstream fs;
assert(!fs.is_open());
- fs.open(std::string(temp), std::ios_base::in | std::ios_base::out
+ fs.open(temp, std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
assert(fs.is_open());
double x = 0;
@@ -46,5 +46,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove(temp);
+ std::remove(temp.c_str());
}
OpenPOWER on IntegriCloud