aboutsummaryrefslogtreecommitdiff
path: root/tests/function/path
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-12-02 10:16:00 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-12-02 10:19:27 +0200
commitbe57ba464fae756d5eb44cf4faf192536dec43ec (patch)
tree362b35157a2e8bd8de1e495ae0da67394c77d01a /tests/function/path
parentd3568852ca0506666fbd1b613439a3916c76ed88 (diff)
Add $root_directory(<path>) function
Diffstat (limited to 'tests/function/path')
-rw-r--r--tests/function/path/testscript22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/function/path/testscript b/tests/function/path/testscript
index b0c97c9..142c866 100644
--- a/tests/function/path/testscript
+++ b/tests/function/path/testscript
@@ -49,6 +49,28 @@ if! $posix
$* <'print $path.directory(a/b c/d/)' >"a/ c/" : dir-names
}
+: root_directory
+:
+{
+ : posix
+ :
+ if $posix
+ {
+ $* <'print $root_directory([path] /a/b)' >'/' : basics
+ $* <'print $root_directory([path] /)' >'/' : root
+ }
+
+ : windows
+ :
+ if $windows
+ {
+ $* <'print $root_directory([path] "c:\\a\\b")' >'c:\' : basics
+ $* <'print $root_directory([path] "c:")' >'c:\' : root
+ }
+
+ $* <'print $root_directory([path] a/b)' >'' : relative
+}
+
: base
:
{