summaryrefslogtreecommitdiffstats
path: root/tests/018
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-07-10 14:58:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-07-10 14:58:43 -0700
commite11ce7002975eb2ad785f4bd9ca3f0c95a86a9aa (patch)
treeccf54826f68204076d30c5ff33909bf6b19f7cb3 /tests/018
parent91d1a70c1d64c67bbaa5dc94dabf7461ad97bb8d (diff)
downloadtxr-e11ce7002975eb2ad785f4bd9ca3f0c95a86a9aa.tar.gz
txr-e11ce7002975eb2ad785f4bd9ca3f0c95a86a9aa.tar.bz2
txr-e11ce7002975eb2ad785f4bd9ca3f0c95a86a9aa.zip
New function: add-suffix.
* stream.c, stream.h (add_suffix): New function. (stream_init): add-suffix intrinsic registered. * tests/018/path.tl: Tests. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'tests/018')
-rw-r--r--tests/018/path.tl19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/018/path.tl b/tests/018/path.tl
index 62dbda6c..7761e0fe 100644
--- a/tests/018/path.tl
+++ b/tests/018/path.tl
@@ -134,6 +134,25 @@
(trim-long-suffix "/a.//") "/a//")
(mtest
+ (add-suffix "" "") ""
+ (add-suffix "" "a") "a"
+ (add-suffix "." "a") ".a"
+ (add-suffix "." ".a") "..a"
+ (add-suffix "/" ".b") "/.b"
+ (add-suffix "//" ".b") "/.b/"
+ (add-suffix "//" "b") "/b/"
+ (add-suffix "a" "") "a"
+ (add-suffix "a" ".b") "a.b"
+ (add-suffix "a/" ".b") "a.b/"
+ (add-suffix "a//" ".b") "a.b//"
+
+ (add-suffix "c://" "x") "c:/x/"
+ (add-suffix "0://" "x") "0:/x/"
+ (add-suffix "host://" "x") "host://x"
+ (add-suffix "host:///" "x") "host://x/"
+ (add-suffix "1234:///" "x") "1234://x/")
+
+(mtest
(base-name "") ""
(base-name "/") "/"
(base-name ".") "."