aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-01-29 18:44:07 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2022-01-29 18:49:05 +0100
commit385ebecece12ad556683f8c98b8f9d612795737a (patch)
treea58818c4cbd79b917ac217e60f25a3abbd05580b /tests
parentAdd ~b and ~p flags to datetime parser. (diff)
downloadcalp-385ebecece12ad556683f8c98b8f9d612795737a.tar.gz
calp-385ebecece12ad556683f8c98b8f9d612795737a.tar.xz
Add span-upto.
Diffstat (limited to 'tests')
-rw-r--r--tests/util.scm12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/util.scm b/tests/util.scm
index de8d4b2a..6d4ca262 100644
--- a/tests/util.scm
+++ b/tests/util.scm
@@ -3,7 +3,7 @@
;;; Code:
(((calp util) filter-sorted set/r!
- find-min find-max))
+ find-min find-max span-upto))
(test-equal "Filter sorted"
'(3 4 5)
@@ -36,3 +36,13 @@
(test-error 'misc-error (find-extreme '()))
+
+(call-with-values (lambda () (span-upto 2 char-numeric? (string->list "123456")))
+ (lambda (head tail)
+ (test-equal '(#\1 #\2) head)
+ (test-equal '(#\3 #\4 #\5 #\6) tail)))
+
+(call-with-values (lambda () (span-upto 2 char-numeric? (string->list "H123456")))
+ (lambda (head tail)
+ (test-equal '() head)
+ (test-equal '(#\H #\1 #\2 #\3 #\4 #\5 #\6) tail)))