aboutsummaryrefslogtreecommitdiff
path: root/tests/function/filesystem/testscript
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-05-22 08:03:52 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-05-22 08:03:52 +0200
commit5a791d140e3033dbe47301fc324f8282ba182459 (patch)
tree3c8e72135deb31192f1c9f0411ae7495bdec9a1e /tests/function/filesystem/testscript
parente416c54b985832c25f0e7861a3c295303ffb9da1 (diff)
Add $filesystem.file_exists(), $filesystem.directory_exists()
Diffstat (limited to 'tests/function/filesystem/testscript')
-rw-r--r--tests/function/filesystem/testscript48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/function/filesystem/testscript b/tests/function/filesystem/testscript
index cf93b8b..c7c08f1 100644
--- a/tests/function/filesystem/testscript
+++ b/tests/function/filesystem/testscript
@@ -73,3 +73,51 @@
EOE
}
}
+
+: file_exists
+:
+{
+ : file
+ :
+ touch f;
+ $* <'print $file_exists(f)' >'true'
+
+ : symlink
+ :
+ touch f && ln -s f s;
+ $* <'print $file_exists([path] s)' >'true'
+
+ : directory
+ :
+ mkdir d;
+ $* <'print $file_exists([dir_path] d)' >'false'
+
+ : testscript
+ :
+ touch f;
+ echo $file_exists(f) >'true'
+}
+
+: directory_exists
+:
+{
+ : directory
+ :
+ mkdir d;
+ $* <'print $directory_exists(d)' >'true'
+
+ : symlink
+ :
+ mkdir d && ln -s d s;
+ $* <'print $directory_exists([dir_path] d)' >'true'
+
+ : file
+ :
+ touch f;
+ $* <'print $directory_exists([path] f)' >'false'
+
+ : testscript
+ :
+ mkdir d;
+ echo $directory_exists(d) >'true'
+}