2 ;;;; fluids.test --- test suite for fluid values
4 ;;;; Copyright (C) 2010 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-fluids)
21 :use-module (test-suite lib))
24 (define a (make-fluid))
25 (define b (make-fluid))
28 (with-test-prefix "initial fluid values"
29 (pass-if "fluid-ref uninitialized fluid is #f"
32 (with-test-prefix "with-fluids with non-fluid"
33 (pass-if-exception "exception raised if nonfluid passed to with-fluids"
34 exception:wrong-type-arg
38 (expect-fail "fluids not modified if nonfluid passed to with-fluids"
39 (catch 'wrong-type-arg
45 (not (fluid-ref a))))))
47 (with-test-prefix "with-fluids with duplicate fluid"
48 (pass-if "last value wins"
51 (eqv? (fluid-ref a) 2)))
53 (pass-if "original value restored"
54 (and (with-fluids ((a 1)
56 (eqv? (fluid-ref a) 2))
57 (eqv? (fluid-ref a) #f))))