summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-09-10 00:08:36 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-09-10 00:08:36 -0700
commitb23424f8d0b093b3438e9c6a2665a543decd7355 (patch)
tree4cddca123726e7182aecdde254198fd0cd8128f8
parent7f471fde70ef66c3e9bcbe4d96885e9455722da1 (diff)
downloadtxr-b23424f8d0b093b3438e9c6a2665a543decd7355.tar.gz
txr-b23424f8d0b093b3438e9c6a2665a543decd7355.tar.bz2
txr-b23424f8d0b093b3438e9c6a2665a543decd7355.zip
tests: add tests for list-builder and fix bug.
* share/txr/stdlib/build.tl (list-buider pend*): Fix typo: apply should be append. Funny, this didn't propagate to ncon*. * tests/012/seq.tl: Some list-builder tests via build macro.
-rw-r--r--share/txr/stdlib/build.tl2
-rw-r--r--tests/012/seq.tl10
2 files changed, 11 insertions, 1 deletions
diff --git a/share/txr/stdlib/build.tl b/share/txr/stdlib/build.tl
index 2c9f97ca..c607571f 100644
--- a/share/txr/stdlib/build.tl
+++ b/share/txr/stdlib/build.tl
@@ -60,7 +60,7 @@
(:method pend* (self . lists)
(let* ((h self.head)
- (pf [apply apply (append lists (list (cdr h)))]))
+ (pf [apply append (append lists (list (cdr h)))]))
(usr:rplacd h pf)
(set self.tail self.head))
nil)
diff --git a/tests/012/seq.tl b/tests/012/seq.tl
index 66361cfb..9c3821d1 100644
--- a/tests/012/seq.tl
+++ b/tests/012/seq.tl
@@ -7,3 +7,13 @@
(test (append '(1) 2) (1 . 2))
(test (append '(1 . 2) 2) :error)
(test (append '(1 . #(3 4 5)) "d") (1 . #(3 4 5 #\d)))
+
+(test (build (add 1) (add 2) (pend (get))) (1 2 1 2))
+(test (build (add 1) (add 2) (pend* (get))) (1 2 1 2))
+(test (build (add 1) (add 2) (pend (get) (get))) (1 2 1 2 1 2))
+(test (build (add 1) (add 2) (pend* (get) (get))) (1 2 1 2 1 2))
+
+(set *print-circle* t)
+
+(stest (build (add 1) (add 2) (ncon (get))) "#1=(1 2 . #1#)")
+(stest (build (add 1) (add 2) (ncon* (get))) "#1=(1 2 . #1#)")