summaryrefslogtreecommitdiffstats
path: root/tests/015
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-28 22:40:59 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-28 22:40:59 -0700
commitbc591cb5ee04582dbdf17a0125987ec03e8c064f (patch)
treed105da9c40623bf044a4d03ff1c8b270a1c8a466 /tests/015
parent3692b3b96af9159368a7bfe63798bb67ff90367f (diff)
downloadtxr-bc591cb5ee04582dbdf17a0125987ec03e8c064f.tar.gz
txr-bc591cb5ee04582dbdf17a0125987ec03e8c064f.tar.bz2
txr-bc591cb5ee04582dbdf17a0125987ec03e8c064f.zip
tok-str: takes count argument.
* eval.c (eval_init): Update registration of tok-str. * lib.c (tok_str): New argument, count_opt. Implemented in the compat 155 case; what the heck. (tok): Pass nil to new parameter of tok_str. * lib.h (tok_str): Declaration updated. * tests/015/split.tl: New tests. * txr.1: Documented.
Diffstat (limited to 'tests/015')
-rw-r--r--tests/015/split.tl15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/015/split.tl b/tests/015/split.tl
index 8cdf7f04..9e952342 100644
--- a/tests/015/split.tl
+++ b/tests/015/split.tl
@@ -196,6 +196,21 @@
(tok-str "abcacabcac" #/ab?/ t) ("" "ab" "c" "a" "c" "ab" "c" "a" "c"))
(mtest
+ (tok-str "" #/[^,]/ : 0) ()
+ (tok-str "a,b,c" #/[^,]/ : 0) ("a,b,c")
+ (tok-str "a,b,c" #/[^,]/ : 1) ("a" ",b,c")
+ (tok-str "a,b,c" #/[^,]/ : 2) ("a" "b" ",c")
+ (tok-str "a,b,c" #/[^,]/ : 3) #"a b c"
+ (tok-str "a,b,c" #/[^,]/ : 4) #"a b c")
+
+(mtest
+ (tok-str "a,b,c" #/[^,]/ t 0) ("a,b,c")
+ (tok-str "a,b,c" #/[^,]/ t 1) ("" "a" ",b,c")
+ (tok-str "a,b,c" #/[^,]/ t 2) ("" "a" "," "b" ",c")
+ (tok-str "a,b,c" #/[^,]/ t 3) ("" "a" "," "b" "," "c" "")
+ (tok-str "a,b,c" #/[^,]/ t 4) ("" "a" "," "b" "," "c" ""))
+
+(mtest
(join) ""
(join "") ""
(join "" "") ""