aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/dir-iterator/testscript18
-rw-r--r--tests/link/driver.cxx34
2 files changed, 50 insertions, 2 deletions
diff --git a/tests/dir-iterator/testscript b/tests/dir-iterator/testscript
index 5169e9b..956eacb 100644
--- a/tests/dir-iterator/testscript
+++ b/tests/dir-iterator/testscript
@@ -15,6 +15,9 @@ $* a >"reg b"
mkdir -p a/b;
$* a >"dir b"
+# Note that on Windows only directory symlinks are currently supported (see
+# mksymlink() for details).
+#
: dangling-link
:
if ($cxx.target.class != 'windows')
@@ -29,3 +32,18 @@ if ($cxx.target.class != 'windows')
$* ../a >! 2>! != 0 : keep
$* -i ../a >'reg c' : skip
}
+else
+{
+ +mkdir a
+ +mkdir --no-cleanup a/b
+ +ln -s a/b a/l
+ +rmdir a/b
+
+ +touch a/c
+
+ # On Wine dangling symlinks are not visible (see mksymlink() for details).
+ #
+ #$* ../a >! 2>! != 0 : keep
+
+ $* -i ../a >'reg c' : skip
+}
diff --git a/tests/link/driver.cxx b/tests/link/driver.cxx
index 7aebeae..76cdbfc 100644
--- a/tests/link/driver.cxx
+++ b/tests/link/driver.cxx
@@ -177,9 +177,39 @@ main ()
// Create the directory symlink using an absolute path.
//
dir_path ld (td / dir_path ("dslink"));
- assert (link_dir (dp, ld, false, true));
+ assert (link_dir (dp, ld, false /* hard */, true /* check_content */));
- try_rmsymlink (ld);
+ {
+ pair<bool, entry_stat> pe (path_entry (ld / "f"));
+ assert (pe.first && pe.second.type == entry_type::regular);
+ }
+
+ {
+ pair<bool, entry_stat> pe (path_entry (ld));
+ assert (pe.first && pe.second.type == entry_type::symlink);
+ }
+
+ {
+ pair<bool, entry_stat> pe (path_entry (ld, true /* follow_symlinks */));
+ assert (pe.first && pe.second.type == entry_type::directory);
+ }
+
+ for (const dir_entry& de: dir_iterator (td, false /* ignore_dangling */))
+ {
+ assert (de.path () != path ("dslink") ||
+ (de.type () == entry_type::directory &&
+ de.ltype () == entry_type::symlink));
+ }
+
+ // Remove the directory symlink and make sure the target's content still
+ // exists.
+ //
+ assert (try_rmsymlink (ld) == rmfile_status::success);
+
+ {
+ pair<bool, entry_stat> pe (path_entry (dp / "f"));
+ assert (pe.first && pe.second.type == entry_type::regular);
+ }
#ifndef _WIN32
// Create the directory symlink using an unexistent directory path.