aboutsummaryrefslogtreecommitdiff
path: root/tests/fdstream
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-03-07 14:07:28 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-03-09 14:18:20 +0300
commitdcccba655fe848564e961b3f285ce3a82d3ac73a (patch)
tree598ced3b406d80c23798672930e1a17cfe112b75 /tests/fdstream
parent63b2988e4f2630cc688ff43b7e5f0d4f977896cd (diff)
Add more support for symlinks on Windows
See mksymlink() for details of the symlinks support on Windows.
Diffstat (limited to 'tests/fdstream')
-rw-r--r--tests/fdstream/driver.cxx38
1 files changed, 26 insertions, 12 deletions
diff --git a/tests/fdstream/driver.cxx b/tests/fdstream/driver.cxx
index 097383c..3215e02 100644
--- a/tests/fdstream/driver.cxx
+++ b/tests/fdstream/driver.cxx
@@ -419,26 +419,40 @@ main (int argc, const char* argv[])
ofs.clear (ofdstream::failbit);
}
-#ifndef _WIN32
-
- // Fail for an existing symlink to unexistent file.
+ // Note that on Windows regular file symlinks may not be supported (see
+ // mksymlink() for details), so the following tests are allowed to fail
+ // with ENOSYS on Windows.
//
- path link (td / path ("link"));
- mksymlink (td / path ("unexistent"), link);
-
try
{
- fdopen (link, (fdopen_mode::out |
- fdopen_mode::create |
- fdopen_mode::exclusive));
+ // Fail for an existing symlink to unexistent file.
+ //
+ path link (td / path ("link"));
+ mksymlink (td / path ("unexistent"), link);
- assert (false);
+ try
+ {
+ fdopen (link, (fdopen_mode::out |
+ fdopen_mode::create |
+ fdopen_mode::exclusive));
+
+ assert (false);
+ }
+ catch (const ios::failure&)
+ {
+ }
}
- catch (const ios::failure&)
+ catch (const system_error& e)
{
+#ifndef _WIN32
+ assert (false);
+#else
+ assert (e.code ().category () == generic_category () &&
+ e.code ().value () == ENOSYS);
+#endif
}
-#else
+#ifdef _WIN32
// Check translation modes.
//