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 library is free software; you can redistribute it and/or
7 ;;;; modify it under the terms of the GNU Lesser General Public
8 ;;;; License as published by the Free Software Foundation; either
9 ;;;; version 3 of the License, or (at your option) any later version.
11 ;;;; This library 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 GNU
14 ;;;; Lesser General Public License for more details.
16 ;;;; You should have received a copy of the GNU Lesser General Public
17 ;;;; License along with this library; if not, write to the Free Software
18 ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 (define-module (test-suite test-optargs)
21 :use-module (test-suite lib)
22 :use-module (ice-9 optargs))
24 (with-test-prefix "optional argument processing"
25 (pass-if "local defines work with optional arguments"
27 (define* (test-1 #:optional (x 0))
28 (define d 1) ; local define
30 (false-if-exception (test-1)))
31 (interaction-environment))))
37 (with-test-prefix "let-keywords"
39 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
40 ;; which caused apparently internal defines to "leak" out into the
41 ;; encompasing environment
42 (pass-if-exception "empty bindings internal defines leaking out"
45 (let-keywords rest #f ()
51 (let-keywords '(#:foo 123) #f (foo)
58 (with-test-prefix "let-keywords*"
60 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
61 ;; which caused apparently internal defines to "leak" out into the
62 ;; encompasing environment
63 (pass-if-exception "empty bindings internal defines leaking out"
66 (let-keywords* rest #f ()
72 (let-keywords* '(#:foo 123) #f (foo)
79 (with-test-prefix "let-optional"
81 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
82 ;; which caused apparently internal defines to "leak" out into the
83 ;; encompasing environment
84 (pass-if-exception "empty bindings internal defines leaking out"
94 (let-optional rest ((foo 999))
101 (with-test-prefix "let-optional*"
103 ;; in guile 1.6.4 and earlier, an empty binding list only used `begin',
104 ;; which caused apparently internal defines to "leak" out into the
105 ;; encompasing environment
106 (pass-if-exception "empty bindings internal defines leaking out"
107 exception:unbound-var
109 (let-optional* rest ()
116 (let-optional* rest ((foo 999))