aboutsummaryrefslogtreecommitdiff
path: root/tests/link/driver.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-03-03 16:28:33 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-03-03 16:28:33 +0300
commit33f841eba0667c770c3a79c1af36444ecdffca67 (patch)
tree2e540eb3d3633e25723b92b28953e0161ad9d155 /tests/link/driver.cxx
parent3045a5709df597526f474aa0c5a583a76d9921db (diff)
Revert previous (erroneously pushed to master) commit
Diffstat (limited to 'tests/link/driver.cxx')
-rw-r--r--tests/link/driver.cxx43
1 files changed, 12 insertions, 31 deletions
diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx
index 79f381d..96ac880 100644
--- a/tests/link/driver.cxx
+++ b/tests/link/driver.cxx
@@ -35,33 +35,18 @@ using namespace butl;
static const char text[] = "ABCDEF";
-enum class mklink
-{
- sym,
- hard,
- any
-};
-
static bool
-link_file (const path& target, const path& link, mklink ml, bool check_content)
+link_file (const path& target, const path& link, bool hard, bool check_content)
{
try
{
- switch (ml)
- {
- case mklink::sym: mksymlink (target, link); break;
- case mklink::hard: mkhardlink (target, link); break;
- case mklink::any: mkanylink (target, link, true /* copy */); break;
- }
- }
- catch (const system_error& e)
- {
- cerr << e << endl;
- return false;
+ if (hard)
+ mkhardlink (target, link);
+ else
+ mksymlink (target, link);
}
- catch (const pair<entry_type, system_error>& e)
+ catch (const system_error&)
{
- cerr << e.second << endl;
return false;
}
@@ -154,26 +139,22 @@ main ()
// Create the file hard link.
//
- assert (link_file (fp, td / path ("hlink"), mklink::hard, true));
+ assert (link_file (fp, td / path ("hlink"), true, true));
#ifndef _WIN32
// Create the file symlink using an absolute path.
//
- assert (link_file (fp, td / path ("slink"), mklink::sym, true));
+ assert (link_file (fp, td / path ("slink"), false, true));
// Create the file symlink using a relative path.
//
- assert (link_file (fn, td / path ("rslink"), mklink::sym, true));
+ assert (link_file (fn, td / path ("rslink"), false, true));
// Create the file symlink using an unexistent file path.
//
- assert (link_file (fp + "-a", td / path ("sa"), mklink::sym, false));
+ assert (link_file (fp + "-a", td / path ("sa"), false, false));
#endif
- // Create the file any link.
- //
- assert (link_file (fp, td / path ("alink"), mklink::any, true));
-
// Prepare the target directory.
//
dir_path dn ("dir");
@@ -188,8 +169,8 @@ main ()
}
#ifndef _WIN32
- assert (link_file (fp, dp / path ("hlink"), mklink::hard, true));
- assert (link_file (fp, dp / path ("slink"), mklink::sym, true));
+ assert (link_file (fp, dp / path ("hlink"), true, true));
+ assert (link_file (fp, dp / path ("slink"), false, true));
#endif
// Create the directory symlink using an absolute path.