1 ;;;; srfi-11.test --- exercise SRFI-11 let-values
3 ;;;; Copyright 2004, 2006 Free Software Foundation, Inc.
5 ;;;; This library is free software; you can redistribute it and/or
6 ;;;; modify it under the terms of the GNU Lesser General Public
7 ;;;; License as published by the Free Software Foundation; either
8 ;;;; version 3 of the License, or (at your option) any later version.
10 ;;;; This library is distributed in the hope that it will be useful,
11 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 ;;;; Lesser General Public License for more details.
15 ;;;; You should have received a copy of the GNU Lesser General Public
16 ;;;; License along with this library; if not, write to the Free Software
17 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 (define-module (test-suite test-srfi-11)
20 #:use-module (test-suite lib)
21 #:use-module (srfi srfi-11))
28 (with-test-prefix "let-values"
30 (with-test-prefix "no exprs"
36 (with-test-prefix "one expr"
39 (let-values ((() (values)))
43 (let-values (((x) (values 1)))
46 (pass-if "one value as rest"
47 (let-values ((x (values 1)))
51 (let-values (((x y) (values 1 2)))
55 (with-test-prefix "two exprs"
57 (pass-if "no values each"
58 (let-values ((() (values))
62 (pass-if "one value / no values"
63 (let-values (((x) (values 1))
67 (pass-if "one value each"
68 (let-values (((x) (values 1))
73 (pass-if-exception "first binding invisible to second expr"
74 '(unbound-variable . ".*")
75 (let-values (((x) (values 1))
76 ((y) (values (1+ x))))
83 (with-test-prefix "let*-values"
85 (with-test-prefix "no exprs"
91 (with-test-prefix "one expr"
94 (let*-values ((() (values)))
98 (let*-values (((x) (values 1)))
101 (pass-if "one value as rest"
102 (let-values ((x (values 1)))
105 (pass-if "two values"
106 (let*-values (((x y) (values 1 2)))
110 (with-test-prefix "two exprs"
112 (pass-if "no values each"
113 (let*-values ((() (values))
117 (pass-if "one value / no values"
118 (let*-values (((x) (values 1))
122 (pass-if "one value each"
123 (let*-values (((x) (values 1))
128 (pass-if "first binding visible to second expr"
129 (let*-values (((x) (values 1))
130 ((y) (values (1+ x))))