summaryrefslogtreecommitdiffstats
path: root/tests/018
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-06-29 07:36:38 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-06-29 07:36:38 -0700
commitd5d2a4c79c2e6203798cf985df5f23964a04817f (patch)
treea7e7d9451eaba0e99bb8dfb7e7081170ad55db89 /tests/018
parent86fd2fab95618f6b097a80002da783f02a799d75 (diff)
downloadtxr-d5d2a4c79c2e6203798cf985df5f23964a04817f.tar.gz
txr-d5d2a4c79c2e6203798cf985df5f23964a04817f.tar.bz2
txr-d5d2a4c79c2e6203798cf985df5f23964a04817f.zip
path-cat: becomes variadic.
* stream.c (path_vcat): New static function. (stream_init): Register path-cat instrinsic to path_vcat rather than path_cat. * tests/018/path.tl: path-cat tests: all examples from documentation, plus others. * txr.1: Documented existing behaviors that were not clear, like when inputs are empty. Documented new variadic semantics. Examples added.
Diffstat (limited to 'tests/018')
-rw-r--r--tests/018/path.tl32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/018/path.tl b/tests/018/path.tl
index 16c44d77..96298dfd 100644
--- a/tests/018/path.tl
+++ b/tests/018/path.tl
@@ -96,3 +96,35 @@
(base-name "a.b/" ".b") "a"
(base-name "a.b/" ".b/") "a.b"
(base-name "a.b/" "a.b") "a.b")
+
+(mtest
+ (path-cat "" "") ""
+ (path-cat "" ".") "."
+ (path-cat "." "") "."
+ (path-cat "." ".") "."
+ (path-cat "abc" ".") "abc"
+ (path-cat "." "abc") "abc"
+ (path-cat "./" ".") "./"
+ (path-cat "." "./") "./"
+ (path-cat "abc/" ".") "abc/"
+ (path-cat "./" "abc") "abc"
+ (path-cat "/" ".") "/"
+ (path-cat "/" "abc") "/abc"
+ (path-cat "ab/cd" "ef") "ab/cd/ef"
+ (path-cat "a" "b" "c") "a/b/c"
+ (path-cat "a" "b" "" "c" "/") "a/b/c/")
+
+(mtest
+ (path-cat) "."
+ (path-cat 3) :error
+ (path-cat "") ""
+ (path-cat "/") "/"
+ (path-cat ".") "."
+ (path-cat "" "" "") ""
+ (path-cat "." "" "") "."
+ (path-cat "" "." "") "."
+ (path-cat "" "" ".") "."
+ (path-cat "." "." ".") "."
+ (path-cat "abc/" "/def/" "g") "abc/def/g"
+ (path-cat "abc/" "/def/" "g/") "abc/def/g/"
+ (path-cat "" "abc/" "/def/" "g/") "abc/def/g/")