aboutsummaryrefslogtreecommitdiffstats
path: root/test/pattern
diff options
context:
space:
mode:
authorGravatar Peter McGoron 2025-06-20 10:02:46 -0400
committerGravatar Peter McGoron 2025-06-20 10:02:46 -0400
commit6119e2c8401048eb688f2b6b2d1e5ce6e9fb9394 (patch)
tree1347bf9072b624f7648a344f680fdb106e9f0c80 /test/pattern
parentadd vector patterns (diff)
test (x ... y ... z ...)
Diffstat (limited to 'test/pattern')
-rw-r--r--test/pattern/producer.scm43
-rw-r--r--test/pattern/producer.sld1
2 files changed, 41 insertions, 3 deletions
diff --git a/test/pattern/producer.scm b/test/pattern/producer.scm
index 7b61fd8..9ec8857 100644
--- a/test/pattern/producer.scm
+++ b/test/pattern/producer.scm
@@ -80,6 +80,19 @@
(length got))
(test-eqv "first value is 0" 0 (car got))
(test-assert "second value" (bound-identifier=? (cadr got) (empty-wrap '...)))))
+ (test-group "(x ... y ... z ...)"
+ (let ((producer
+ (compile-producer '()
+ (list (empty-wrap 'x) (empty-wrap '...)
+ (empty-wrap 'y) (empty-wrap '...)
+ (empty-wrap 'z) (empty-wrap '...))
+ (idmap (empty-wrap 'x) 1
+ (empty-wrap 'y) 1
+ (empty-wrap 'z) 1))))
+ (test-equal '(1 2 3 10 20 30 100 200 300)
+ (producer (idmap (empty-wrap 'x) '(3 2 1)
+ (empty-wrap 'y) '(30 20 10)
+ (empty-wrap 'z) '(300 200 100))))))
(test-group "(let-values (((names ...) value ...) ...) body ...)"
(let* ((producer
(compile-producer '()
@@ -139,8 +152,8 @@
;; should emulate Chez's output.
(let* ((pat
(list (list (list (empty-wrap 'x)
- (list (empty-wrap 'x) (empty-wrap '...)))
- (empty-wrap '...))
+ (list (empty-wrap 'x) (empty-wrap '...)))
+ (empty-wrap '...))
(empty-wrap '...)))
(producer (compile-producer '() pat (idmap (empty-wrap 'x) 2))))
(test-equal '(((1 (1 2)) (2 (3 4))) ((3 (1 2)) (4 (3 4))))
@@ -179,6 +192,28 @@
#(80 90 100)
(producer (idmap (empty-wrap 'x) '(90 80))))))
+(define (test-improper-list)
+ (let ((producer
+ (compile-producer '()
+ (cons (empty-wrap 'x) (empty-wrap 'y))
+ (idmap (empty-wrap 'x) 0
+ (empty-wrap 'y) 0))))
+ (test-equal "(x . y)"
+ '(10 . 20)
+ (producer (idmap (empty-wrap 'x) 10
+ (empty-wrap 'y) 20))))
+ (let ((producer
+ (compile-producer '()
+ (cons* (empty-wrap 'x)
+ (empty-wrap '...)
+ (empty-wrap 'y))
+ (idmap (empty-wrap 'x) 1
+ (empty-wrap 'y) 0))))
+ (test-equal "(x ... . y)"
+ '(1 2 3 4 5 . 0)
+ (producer (idmap (empty-wrap 'x) '(5 4 3 2 1)
+ (empty-wrap 'y) 0)))))
+
(define (test-producers)
(test-group "producers"
(test-group "self-syntax"
@@ -186,4 +221,6 @@
(test-group "list ellipses"
(test-list-ellipses))
(test-group "vector patterns"
- (test-vector)))) \ No newline at end of file
+ (test-vector))
+ (test-group "improper list"
+ (test-improper-list)))) \ No newline at end of file
diff --git a/test/pattern/producer.sld b/test/pattern/producer.sld
index 5fd3a57..1af8896 100644
--- a/test/pattern/producer.sld
+++ b/test/pattern/producer.sld
@@ -15,6 +15,7 @@
(define-library (multisyntax pattern producer test)
(import (scheme base) (scheme write) (srfi 113) (srfi 146 hash)
+ (srfi 1)
(multisyntax syntax-object)
(multisyntax pattern producer))
(cond-expand
s='insertions'>+38 2000-09-13Fix raw1394_start_iso_write() which uses wrong variable.Gravatar aeb 1-1/+1 2000-09-10Work around compiler warnings for int/ptr casts.Gravatar aeb 6-10/+20 2000-09-10Added control files for Debian packages.Gravatar aeb 6-8/+106 2000-09-01Added missing prototypes for iso send functions.Gravatar aeb 1-0/+7 2000-08-08Added raw1394_get_irm_id().Gravatar aeb 7-7/+39 2000-08-06Added support for isochronous sending.Gravatar aeb 3-0/+35 2000-07-05Added raw1394_reset_bus() call.Gravatar aeb 4-0/+23 2000-06-22- Set library version info in configure.in, use in src/Makefile.am.Gravatar aeb 4-2/+16 2000-06-15Update libtool version number.Gravatar aeb 2-2/+2 2000-06-14Added copyright headers.Gravatar aeb 6-0/+54 2000-06-11Added explicit AC_PROG_INSTALL call.Gravatar aeb 1-0/+1 2000-06-09Fix size of error field.Gravatar aeb 1-2/+2 2000-06-02Modified support for 32/64 bit environments, control struct fields have fixed...Gravatar aeb 7-43/+28 2000-05-28Added support for environments with 64 bit kernel and 32 bit userland.Gravatar aeb 8-7/+45 2000-04-27Fixed missing setting of ext code in raw1394_start_lock()Gravatar aeb 1-0/+1 2000-04-15Fixed lock transaction to actually return response value.Gravatar aeb 3-5/+11 2000-04-12Add userdata functions as news.Gravatar aeb 1-0/+4 2000-04-05Add userdata functions.Gravatar aeb 3-0/+18 2000-03-18Bump version number to 0.6.Gravatar aeb 3-5/+6 2000-03-18Mention byte order change.Gravatar aeb 1-0/+2 2000-03-18Mention SourceForge home.Gravatar aeb 1-1/+5