aboutsummaryrefslogtreecommitdiff
path: root/tests/link/testscript
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-03-11 22:50:15 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-03-17 13:15:42 +0300
commit56e49a09b4f1d268bfee83324bbcd44eb925815b (patch)
tree9a8a8395560296fe52ad7b2fef487eef6ee7b4e6 /tests/link/testscript
parentaabd974df745b8f9c061ab162d9babfc9545c108 (diff)
Add readsymlink(), followsymlink(), and try_followsymlink()
Diffstat (limited to 'tests/link/testscript')
-rw-r--r--tests/link/testscript79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/link/testscript b/tests/link/testscript
new file mode 100644
index 0000000..194b093
--- /dev/null
+++ b/tests/link/testscript
@@ -0,0 +1,79 @@
+# file : tests/link/testscript
+# license : MIT; see accompanying LICENSE file
+
+: basics
+:
+$*
+
+: follow-symlinks
+:
+: Note that we may not be able to create symlinks on Windows and so test on
+: POSIX only. But that'is ok since the follow_symlinks() implementation is not
+: platform-specific.
+:
+if ($cxx.target.class != 'windows')
+{
+ : not-symlink
+ :
+ {
+ touch f;
+ $* -f f >f
+ }
+
+ : not-exists
+ :
+ {
+ $* -f f >f
+ }
+
+ : single-link
+ :
+ {
+ : absolute
+ :
+ {
+ $* -s $~/f l &l;
+ $* -f l >/"$~/f"
+ }
+
+ : relative
+ :
+ {
+ $* -s d/f l &l;
+ $* -f l >/'d/f'
+ }
+ }
+
+ : multiple-links
+ :
+ {
+ : relative-path
+ :
+ {
+ mkdir -p d1/d2;
+ $* -s ../d3/f d1/d2/l1 &d1/d2/l1;
+
+ $* -f d1/d2/l1 >/'d1/d3/f';
+ $* -f ../relative-path/d1/d2/l1 >/'../relative-path/d1/d3/f';
+
+ mkdir d4;
+ $* -s ../d1/d2/l1 d4/l2 &d4/l2;
+
+ $* -f d4/l2 >/'d1/d3/f';
+ $* -f $~/d4/l2 >/"$~/d1/d3/f"
+ }
+
+ : absolute-path
+ :
+ {
+ mkdir -p d1/d2;
+ $* -s ../d3/f d1/d2/l1 &d1/d2/l1;
+
+ mkdir d4;
+ $* -s $~/d1/d2/l1 d4/l2 &d4/l2;
+
+ $* -f d4/l2 >/"$~/d1/d3/f";
+ $* -f $~/d4/l2 >/"$~/d1/d3/f"
+ }
+ }
+}