merge from 1.8 branch
[bpt/guile.git] / test-suite / tests / and-let-star.test
CommitLineData
35ce851c
KR
1;;;; and-let-star.test --- Tests for Guile and-let-star module. -*- scheme -*-
2;;;;
6e7d5622 3;;;; Copyright (C) 2004, 2006 Free Software Foundation, Inc.
35ce851c
KR
4;;;;
5;;;; This program is free software; you can redistribute it and/or modify
6;;;; it under the terms of the GNU General Public License as published by
7;;;; the Free Software Foundation; either version 2, or (at your option)
8;;;; any later version.
9;;;;
10;;;; This program 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
13;;;; GNU General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU General Public License
16;;;; along with this software; see the file COPYING. If not, write to
92205699
MV
17;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18;;;; Boston, MA 02110-1301 USA
35ce851c
KR
19
20(define-module (test-suite test-and-let-star)
21 #:use-module (test-suite lib)
22 #:use-module (ice-9 and-let-star))
23
24;;;
25;;; and-let*
26;;;
27
28(with-test-prefix "and-let*"
29
30 (pass-if "cond-expand srfi-2"
31 (cond-expand (srfi-2 #t)
93827cbd
KR
32 (else #f)))
33
34 (with-test-prefix "no bindings"
35
36 (pass-if "no result expression (gives #t)"
37 (and-let* ()))
38
39 (pass-if "result expression"
40 (and-let* ()
41 #t))
42
43 (pass-if "two result expressions"
44 (and-let* ()
45 #f
46 #t)))
47
48 (with-test-prefix "one binding"
49
50 (pass-if "no result expression (gives #t)"
51 (and-let* ((x 123))))
52
53 (pass-if "result expression"
54 (and-let* ((x 123))
55 #t))
56
57 (pass-if "result variable"
58 (and-let* ((x #t))
59 x))
60
61 (pass-if "two result expressions"
62 (and-let* ((x 123))
63 #f
64 #t)))
65
66 (with-test-prefix "one test"
67
68 (pass-if "no result expression (gives #t)"
69 (and-let* (( 123))))
70
71 (pass-if "result expression"
72 (and-let* (( 123))
73 #t))
74
75 (pass-if "two result expressions"
76 (and-let* (( 123))
77 #f
78 #t))))