aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/error.lisp1
-rw-r--r--tests/let-binding.lisp25
2 files changed, 22 insertions, 4 deletions
diff --git a/tests/error.lisp b/tests/error.lisp
index e0e0c4a..c774622 100644
--- a/tests/error.lisp
+++ b/tests/error.lisp
@@ -1,4 +1,5 @@
(assert-error (error ""))
+(assert-error (let ((x (error ""))) #t))
(assert-error (let () (error "") #t))
(assert-error (if (error "") #t #t))
(assert-error (and (error "")))
diff --git a/tests/let-binding.lisp b/tests/let-binding.lisp
index 33d021e..eead06a 100644
--- a/tests/let-binding.lisp
+++ b/tests/let-binding.lisp
@@ -1,7 +1,24 @@
-(assert-error (let ((i 0)) (i > 4)))
-
-(assert (= 3
(let ((a 1)
(b 2))
- (+ a b))))
+ (assert (= 3 (+ a b))))
+
+;; let is letrec by default
+(let ((a 1)
+ (b (+ a 1)))
+ (assert (= 2 b)))
+
+(let ((my-evenp
+ (lambda (x)
+ (if (= x 0)
+ #t
+ (funcall my-oddp (- x 1)))))
+ (my-oddp
+ (lambda (x)
+ (if (= x 0)
+ #f
+ (funcall my-evenp (- x 1))))))
+ (assert (funcall my-evenp 10))
+ (assert (funcall my-oddp 9))
+ (assert (not (funcall my-evenp 9)))
+ (assert (not (funcall my-oddp 10))))