diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-05-21 08:00:23 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-05-21 08:00:23 +0200 |
commit | af8046d5bcf2aec918b1802a7719a09ce0111662 (patch) | |
tree | 7fc10ed55b12f0edce0ec7cd0d85effc032369bf /tests/function/path | |
parent | 6f8d29930130160ff8db5c3905bf4a692f6bf6e7 (diff) |
Add $path.complete(), $path.try_normalize(), $path.try_actualize()
Diffstat (limited to 'tests/function/path')
-rw-r--r-- | tests/function/path/testscript | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/tests/function/path/testscript b/tests/function/path/testscript index 98491ea..d49e9e5 100644 --- a/tests/function/path/testscript +++ b/tests/function/path/testscript @@ -110,37 +110,6 @@ s = ($posix ? '/' : '\') $* <'print $path.super_path(a/b/c, c/a)' >"false" : false } -: canonicalize -: -{ - $* <'print $canonicalize([path] a/b)' >"a$(s)b" : path - $* <'print $canonicalize([paths] a/b a/c)' >"a$(s)b a$(s)c" : paths - $* <'print $canonicalize([dir_path] a/b)' >"a$(s)b$s" : dir-path - $* <'print $canonicalize([dir_paths] a/b a/c/)' >"a$(s)b$s a$(s)c$s" : dir-paths - $* <'print $path.canonicalize(a/b)' >"a$(s)b" : untyped - $* <'print $path.canonicalize(a/b/ a/c)' >"a$(s)b$s a$(s)c" : mixed -} - -: normalize -: -{ - $* <'print $normalize([path] a/../b)' >"b" : path - $* <'print $normalize([paths] a/../b a/../c)' >"b c" : paths - $* <'print $normalize([dir_path] a/../b)' >"b$s" : dir-path - $* <'print $normalize([dir_paths] a/../b a/../c/)' >"b$s c$s" : dir-paths - $* <'print $path.normalize(a/../b)' >"b" : untyped - $* <'print $path.normalize(a/../b/ a/../c)' >"b$s c" : mixed -} - -: actualize -: -if! $posix -{ - mkdir Foo; - $* <'print $path.actualize($out_base/foo)' >~'/.+\\Foo/' -} - - : directory : { @@ -235,6 +204,51 @@ if! $posix EOO } +: complete +: +{ + $* <'print $complete([path] a)' >"$~$(s)a" : path + $* <'print $complete([dir_path] a)' >"$~$(s)a$(s)" : dir-path + $* <'print $path.complete(a)' >"$~$(s)a" : untyped +} + +: canonicalize +: +{ + $* <'print $canonicalize([path] a/b)' >"a$(s)b" : path + $* <'print $canonicalize([paths] a/b a/c)' >"a$(s)b a$(s)c" : paths + $* <'print $canonicalize([dir_path] a/b)' >"a$(s)b$s" : dir-path + $* <'print $canonicalize([dir_paths] a/b a/c/)' >"a$(s)b$s a$(s)c$s" : dir-paths + $* <'print $path.canonicalize(a/b)' >"a$(s)b" : untyped + $* <'print $path.canonicalize(a/b/ a/c)' >"a$(s)b$s a$(s)c" : mixed +} + +: normalize +: +{ + $* <'print $normalize([path] a/../b)' >"b" : path + $* <'print $normalize([paths] a/../b a/../c)' >"b c" : paths + $* <'print $normalize([dir_path] a/../b)' >"b$s" : dir-path + $* <'print $normalize([dir_paths] a/../b a/../c/)' >"b$s c$s" : dir-paths + $* <'print $path.normalize(a/../b)' >"b" : untyped + $* <'print $path.normalize(a/../b/ a/../c)' >"b$s c" : mixed +} + +: try_normalize +: +{ + $* <'print $try_normalize([path] a/../b)' >"b" : valid + $* <'print $path.try_normalize($root_directory($src_root)/..)' >"[null]" : invalid +} + +: actualize +: +if! $posix +{ + mkdir Foo; + $* <'print $path.actualize($out_base/foo)' >~'/.+\\Foo/' +} + : sort : { |