aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-04-24 19:18:34 -0400
committerGravatar Peter McGoron 2025-04-24 19:18:34 -0400
commit28bbd07dc7ab265a0eb8eeb277b7a55ab4240854 (patch)
treeef925f510a7b94b33105093344b01a9c6d677190 /test
parentfix is-ellipsis-list (diff)
fix pattern list creation
Diffstat (limited to '')
-rw-r--r--test/patterns.scm21
-rw-r--r--test/patterns.sld2
2 files changed, 21 insertions, 2 deletions
diff --git a/test/patterns.scm b/test/patterns.scm
index 7669b86..0e9df36 100644
--- a/test/patterns.scm
+++ b/test/patterns.scm
@@ -58,7 +58,26 @@
(test-equal "first" 1 (hashmap-ref returned (empty-wrap 'x)))
(test-equal "second" 2 (hashmap-ref returned (empty-wrap 'y)))))
+(define (test-simple-ellipsis)
+ (define matcher
+ (compile-pattern ellipsis
+ empty-set
+ (list (empty-wrap 'x) ellipsis)))
+ (let* ((list '(1 2 3 4 5 6 7 8))
+ (returned (matcher empty-map list))
+ (x-value (hashmap-ref returned (empty-wrap 'x))))
+ (test-assert "returned is matched-ellipsis"
+ (matched-ellipsis? x-value))
+ (test-equal "(x ...)"
+ (reverse list)
+ (matched-ellipsis-reversed-list x-value)))
+ #;(let* ((returned (matcher empty-map '()))
+ (x-value (hashmap-ref returned (empty-wrap 'x))))))
+
(define (test-patterns)
(test-group "single match" (test-single-match))
(test-group "test match in list" (test-match-in-list))
- (test-group "test multiple matches in list" (test-multiple-matches-in-list))) \ No newline at end of file
+ (test-group "test multiple matches in list"
+ (test-multiple-matches-in-list))
+ (test-group "simple ellipsis" (test-simple-ellipsis))
+ ) \ No newline at end of file
diff --git a/test/patterns.sld b/test/patterns.sld
index fac2736..0d58aa2 100644
--- a/test/patterns.sld
+++ b/test/patterns.sld
@@ -14,7 +14,7 @@
|#
(define-library (multisyntax patterns test)
- (import (scheme base) (srfi 113) (srfi 146 hash)
+ (import (scheme base) (scheme write) (srfi 113) (srfi 146 hash)
(multisyntax syntax-object)
(multisyntax patterns))
(cond-expand