From d5d2a4c79c2e6203798cf985df5f23964a04817f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 29 Jun 2021 07:36:38 -0700 Subject: 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. --- tests/018/path.tl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests/018') 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/") -- cgit v1.2.3