summaryrefslogtreecommitdiffstats
path: root/libcxx/test/input.output/file.streams/fstreams/fstream.cons
diff options
context:
space:
mode:
authorAlexis Hunt <alercah@gmail.com>2011-07-18 20:46:16 +0000
committerAlexis Hunt <alercah@gmail.com>2011-07-18 20:46:16 +0000
commit4c14ed75eeb17df92757cab1c4bb0ad2d0988694 (patch)
treec162a6c5cd73439315b95f0fbc206a006782d6ae /libcxx/test/input.output/file.streams/fstreams/fstream.cons
parent276aab5a2196097f663b4b0132547b09c8c976a3 (diff)
downloadbcm5719-llvm-4c14ed75eeb17df92757cab1c4bb0ad2d0988694.tar.gz
bcm5719-llvm-4c14ed75eeb17df92757cab1c4bb0ad2d0988694.zip
Do a litmus test of using tmpnam to generate safe temporary file names
for the tests that open new data files. llvm-svn: 135422
Diffstat (limited to 'libcxx/test/input.output/file.streams/fstreams/fstream.cons')
-rw-r--r--libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
index b5786a38441..c2872913f9f 100644
--- a/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
+++ b/libcxx/test/input.output/file.streams/fstreams/fstream.cons/string.pass.cpp
@@ -19,8 +19,10 @@
int main()
{
+ char temp [L_tmpnam];
+ tmpnam(temp);
{
- std::fstream fs(std::string("test.dat"),
+ std::fstream fs(std::string(temp),
std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
double x = 0;
@@ -29,9 +31,9 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
{
- std::wfstream fs(std::string("test.dat"),
+ std::wfstream fs(std::string(temp),
std::ios_base::in | std::ios_base::out
| std::ios_base::trunc);
double x = 0;
@@ -40,5 +42,5 @@ int main()
fs >> x;
assert(x == 3.25);
}
- std::remove("test.dat");
+ std::remove(temp);
}
OpenPOWER on IntegriCloud