1 ;;;; optargs.test --- test suite for optional arg processing -*- scheme -*-
2 ;;;; Matthias Koeppe <mkoeppe@mail.math.uni-magdeburg.de> --- June 2001
4 ;;;; Copyright (C) 2001, 2006 Free Software Foundation, Inc.
6 ;;;; This program is free software; you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation; either version 2, or (at your option)
9 ;;;; any later version.
11 ;;;; This program is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;;; GNU General Public License for more details.
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with this software; see the file COPYING. If not, write to
18 ;;;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 ;;;; Boston, MA 02110-1301 USA
21 (define-module (test-suite test-optargs)
22 :use-module (test-suite lib)
23 :use-module (ice-9 optargs))
25 (with-test-prefix "optional argument processing"
26 (pass-if "local defines work with optional arguments"
28 (define* (test-1 #:optional (x 0))
29 (define d 1) ; local define
31 (false-if-exception (test-1)))
32 (interaction-environment))))
38 (with-test-prefix "let-keywords"
40 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
41 ;; which caused apparently internal defines to "leak" out into the
42 ;; encompasing environment
43 (pass-if-exception "empty bindings internal defines leaking out"
46 (let-keywords rest #f ()
52 (let-keywords '(#:foo 123) #f (foo)
59 (with-test-prefix "let-keywords*"
61 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
62 ;; which caused apparently internal defines to "leak" out into the
63 ;; encompasing environment
64 (pass-if-exception "empty bindings internal defines leaking out"
67 (let-keywords* rest #f ()
73 (let-keywords* '(#:foo 123) #f (foo)
80 (with-test-prefix "let-optional"
82 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
83 ;; which caused apparently internal defines to "leak" out into the
84 ;; encompasing environment
85 (pass-if-exception "empty bindings internal defines leaking out"
95 (let-optional rest ((foo 999))
102 (with-test-prefix "let-optional*"
104 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
105 ;; which caused apparently internal defines to "leak" out into the
106 ;; encompasing environment
107 (pass-if-exception "empty bindings internal defines leaking out"
108 exception:unbound-var
110 (let-optional* rest ()
117 (let-optional* rest ((foo 999))