summaryrefslogtreecommitdiffstats
path: root/tests/015
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-02 15:27:50 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-02 15:27:50 -0700
commitffe87454b93115be056a5ec99dd8300dafa9eb18 (patch)
tree0026175e63f647fab7e796f374d89be0fc7366b4 /tests/015
parent28d78722c037c1fc9cc20d50b33ecd100698dfb8 (diff)
downloadtxr-ffe87454b93115be056a5ec99dd8300dafa9eb18.tar.gz
txr-ffe87454b93115be056a5ec99dd8300dafa9eb18.tar.bz2
txr-ffe87454b93115be056a5ec99dd8300dafa9eb18.zip
bug: join-with segfault on character separators.
* lib.c (join_with): Pass the correct onech array down to cat_str_init, rather than a null pointer. * tests/015/split.tl: New tests covering join and join-with.
Diffstat (limited to 'tests/015')
-rw-r--r--tests/015/split.tl23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/015/split.tl b/tests/015/split.tl
index ae77a642..e54092c5 100644
--- a/tests/015/split.tl
+++ b/tests/015/split.tl
@@ -194,3 +194,26 @@
(mtest
(tok-str "abcacabcac" #/ab?/) #"ab a ab a"
(tok-str "abcacabcac" #/ab?/ t) ("" "ab" "c" "a" "c" "ab" "c" "a" "c"))
+
+(mtest
+ (join) ""
+ (join "") ""
+ (join "" "") ""
+ (join #\a) "a"
+ (join "a") "a"
+ (join #\a "b") "ab"
+ (join "a" #\b) "ab"
+ (join #\a #\b) "ab"
+ (join "a" "b") "ab"
+ (join "a" "b" "cde") "abcde")
+
+(mtest
+ (join-with #\a) ""
+ (join-with #\a #\b) "b"
+ (join-with #\a "b") "b"
+ (join-with "a") ""
+ (join-with "a" #\b) "b"
+ (join-with "a" "b") "b"
+ (join-with "a" "b") "b"
+ (join-with "--" "b" "c" "d") "b--c--d"
+ (join-with #\- "b" "c" "d") "b-c-d")