diff options
author | Alexis Hunt <alercah@gmail.com> | 2011-07-18 23:51:21 +0000 |
---|---|---|
committer | Alexis Hunt <alercah@gmail.com> | 2011-07-18 23:51:21 +0000 |
commit | 483cf2454756d623ea202c8ae733d9a954b9a8d7 (patch) | |
tree | bc242419f5b4c7a9918ae4f2029fb30694de2ed6 /libcxx/test/input.output/file.streams/fstreams/fstream.members | |
parent | 353404d924602c1af78315114e67328036d26f94 (diff) | |
download | bcm5719-llvm-483cf2454756d623ea202c8ae733d9a954b9a8d7.tar.gz bcm5719-llvm-483cf2454756d623ea202c8ae733d9a954b9a8d7.zip |
Make all fstream tests use tmpnam if creating files, rather than
hard-coded names.
llvm-svn: 135444
Diffstat (limited to 'libcxx/test/input.output/file.streams/fstreams/fstream.members')
3 files changed, 22 insertions, 16 deletions
diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp index 1aa37dfa4d5..94b91806f81 100644 --- a/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp +++ b/libcxx/test/input.output/file.streams/fstreams/fstream.members/close.pass.cpp @@ -19,22 +19,24 @@ int main() { + char temp[L_tmpnam]; + tmpnam(temp); { std::fstream fs; assert(!fs.is_open()); - fs.open("test.dat", std::ios_base::out); + fs.open(temp, std::ios_base::out); assert(fs.is_open()); fs.close(); assert(!fs.is_open()); } - remove("test.dat"); + remove(temp); { std::wfstream fs; assert(!fs.is_open()); - fs.open("test.dat", std::ios_base::out); + fs.open(temp, std::ios_base::out); assert(fs.is_open()); fs.close(); assert(!fs.is_open()); } - remove("test.dat"); + remove(temp); } diff --git a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp index 4d291ef6e53..64c4de9dfe7 100644 --- a/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp +++ b/libcxx/test/input.output/file.streams/fstreams/fstream.members/open_pointer.pass.cpp @@ -19,11 +19,13 @@ int main() { + char temp[L_tmpnam]; + tmpnam(temp); { std::fstream fs; assert(!fs.is_open()); - fs.open("test.dat", std::ios_base::in | std::ios_base::out - | std::ios_base::trunc); + fs.open(temp, std::ios_base::in | std::ios_base::out + | std::ios_base::trunc); assert(fs.is_open()); double x = 0; fs << 3.25; @@ -31,12 +33,12 @@ int main() fs >> x; assert(x == 3.25); } - std::remove("test.dat"); + std::remove(temp); { std::wfstream fs; assert(!fs.is_open()); - fs.open("test.dat", std::ios_base::in | std::ios_base::out - | std::ios_base::trunc); + fs.open(temp, std::ios_base::in | std::ios_base::out + | std::ios_base::trunc); assert(fs.is_open()); double x = 0; fs << 3.25; @@ -44,5 +46,5 @@ int main() fs >> x; assert(x == 3.25); } - std::remove("test.dat"); + std::remove(temp); } 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 a8e871b59bd..a61a4e965d3 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 @@ -19,11 +19,13 @@ int main() { + char temp[L_tmpnam]; + tmpnam(temp); { std::fstream fs; assert(!fs.is_open()); - fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out - | std::ios_base::trunc); + fs.open(std::string(temp), std::ios_base::in | std::ios_base::out + | std::ios_base::trunc); assert(fs.is_open()); double x = 0; fs << 3.25; @@ -31,12 +33,12 @@ int main() fs >> x; assert(x == 3.25); } - std::remove("test.dat"); + std::remove(temp); { std::wfstream fs; assert(!fs.is_open()); - fs.open(std::string("test.dat"), std::ios_base::in | std::ios_base::out - | std::ios_base::trunc); + fs.open(std::string(temp), std::ios_base::in | std::ios_base::out + | std::ios_base::trunc); assert(fs.is_open()); double x = 0; fs << 3.25; @@ -44,5 +46,5 @@ int main() fs >> x; assert(x == 3.25); } - std::remove("test.dat"); + std::remove(temp); } |