diff options
author | Howard Hinnant <hhinnant@apple.com> | 2013-03-22 20:05:40 +0000 |
---|---|---|
committer | Howard Hinnant <hhinnant@apple.com> | 2013-03-22 20:05:40 +0000 |
commit | 7c5b88b134b0141c3ffda62534572a89d5a9640e (patch) | |
tree | c8e8b66f42f35f8d2249a4dc62dbcf9275bf688e /libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp | |
parent | 7c8dbc12bb73c1d42307e784410a1d5383461732 (diff) | |
download | bcm5719-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.cons/pointer.pass.cpp')
-rw-r--r-- | libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp index a31f9a1d543..06a6b77943a 100644 --- a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp +++ b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/pointer.pass.cpp @@ -16,13 +16,13 @@ #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(temp, std::ios_base::in | std::ios_base::out + std::fstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); double x = 0; fs << 3.25; @@ -30,9 +30,9 @@ int main() fs >> x; assert(x == 3.25); } - std::remove(temp); + std::remove(temp.c_str()); { - std::wfstream fs(temp, std::ios_base::in | std::ios_base::out + std::wfstream fs(temp.c_str(), std::ios_base::in | std::ios_base::out | std::ios_base::trunc); double x = 0; fs << 3.25; @@ -40,5 +40,5 @@ int main() fs >> x; assert(x == 3.25); } - std::remove(temp); + std::remove(temp.c_str()); } |