From f7716ac1a87649cad96242f2d5bf0a987d7f430c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 7 Mar 2022 15:31:00 +0100 Subject: Add new tests. --- tests/test/let.scm | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/test/let.scm (limited to 'tests/test/let.scm') diff --git a/tests/test/let.scm b/tests/test/let.scm new file mode 100644 index 00000000..5312409e --- /dev/null +++ b/tests/test/let.scm @@ -0,0 +1,45 @@ +;;; Commentary: +;; Tests my custom let*. +;;; Code: + +(define-module (test let) + :use-module (srfi srfi-64) + :use-module (srfi srfi-88) + :use-module ((hnh util) :select (let*))) + +(test-assert (let* ((a #t)) a)) + +(test-assert (let* (((a . b) (cons #t #f))) a)) + +(test-assert (let* (((a . b) (cons* #f #t))) b)) + +(test-assert + (let* ((a b c (values #f #t #f))) b)) + +(test-assert + (let* (((a b c) (list #f #t #f))) b)) + +(test-assert (let* (((a) '(#t))) a)) + +(test-equal '(2) (let* (((a . b) '(1 2))) b)) + +(test-equal + '(3 4) + (let* (((a b . c) '(1 2 3 4))) c)) + +(test-equal 10 (let* (x) (set! x 10) x)) + +(test-equal + 30 + (let* (x y) (set! x 10) (set! y 20) (+ x y))) + +(test-assert (let* (x) (not x))) + +(test-equal + 6 + (let* ((x 1) y z) + (set! y 2) + (set! z 3) + (+ x y z))) + + -- cgit v1.2.3