aboutsummaryrefslogtreecommitdiff
path: root/tests/link/driver.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-07-12 17:24:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-07-23 19:42:48 +0300
commit6c8e3f09c185d7fa4664ccd9e5c4f623a17b84cc (patch)
tree513f523dba31f275994d8152c02db82f3380c56e /tests/link/driver.cxx
parent09bedede7116961fbfb298a6a6cfa933af7af682 (diff)
Extend fdstream
Diffstat (limited to 'tests/link/driver.cxx')
-rw-r--r--tests/link/driver.cxx12
1 files changed, 5 insertions, 7 deletions
diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx
index 7ec4ac2..a32a8dc 100644
--- a/tests/link/driver.cxx
+++ b/tests/link/driver.cxx
@@ -4,11 +4,11 @@
#include <set>
#include <cassert>
-#include <fstream>
#include <utility> // pair
#include <system_error>
#include <butl/path>
+#include <butl/fdstream>
#include <butl/filesystem>
using namespace std;
@@ -35,10 +35,9 @@ link_file (const path& target, const path& link, bool hard, bool check_content)
return true;
string s;
- ifstream ifs;
- ifs.exceptions (fstream::badbit | fstream::failbit);
- ifs.open (link.string ());
+ ifdstream ifs (link);
ifs >> s;
+ ifs.close (); // Not to miss failed close of the underlying file descriptor.
return s == text;
}
@@ -93,10 +92,9 @@ main ()
path fp (td / fn);
{
- ofstream ofs;
- ofs.exceptions (fstream::badbit | fstream::failbit);
- ofs.open (fp.string ());
+ ofdstream ofs (fp);
ofs << text;
+ ofs.close ();
}
// Create the file hard link.