diff options
Diffstat (limited to '')
-rw-r--r-- | tests/test/util.scm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test/util.scm b/tests/test/util.scm index 1de96a37..aa37d20c 100644 --- a/tests/test/util.scm +++ b/tests/test/util.scm @@ -187,6 +187,25 @@ (test-error 'wrong-type-arg (find-extreme '())) +;; TODO group-by +;; TODO split-by + +(test-group "Split-by-one-of" + + (test-equal "Empty input" + '(()) (split-by-one-of '() '(+))) + + (test-equal "No matching tokens" + '((1 + 2)) (split-by-one-of '(1 + 2) '(/))) + + (test-equal "Matching tokens" + '((1) (+ 2) (- 3)) + (split-by-one-of '(1 + 2 - 3) '(+ -))) + + (test-equal "Maching tokens, multiple values in each group" + '((1 + 2) (* 3 + 4)) + (split-by-one-of '(1 + 2 * 3 + 4) '(*)))) + (call-with-values (lambda () (span-upto |