diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-07 14:07:28 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-03-09 14:18:20 +0300 |
commit | dcccba655fe848564e961b3f285ce3a82d3ac73a (patch) | |
tree | 598ced3b406d80c23798672930e1a17cfe112b75 /tests/fdstream/driver.cxx | |
parent | 63b2988e4f2630cc688ff43b7e5f0d4f977896cd (diff) |
Add more support for symlinks on Windows
See mksymlink() for details of the symlinks support on Windows.
Diffstat (limited to 'tests/fdstream/driver.cxx')
-rw-r--r-- | tests/fdstream/driver.cxx | 38 |
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. // |