Change Guile license to LGPLv3+
[bpt/guile.git] / test-suite / standalone / test-use-srfi.in
1 #!/bin/sh
2
3 # Copyright (C) 2006 Free Software Foundation, Inc.
4 #
5 # This library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public License
7 # as published by the Free Software Foundation; either version 3 of
8 # the License, or (at your option) any later version.
9 #
10 # This library is distributed in the hope that it will be useful, but
11 # 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.
14 #
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
18 # 02110-1301 USA
19
20
21 # Test that two srfi numbers on the command line work.
22 #
23 guile -q --use-srfi=1,10 >/dev/null <<EOF
24 (if (and (defined? 'partition)
25 (defined? 'define-reader-ctor))
26 (exit 0) ;; good
27 (exit 1)) ;; bad
28 EOF
29 if test $? = 0; then :; else
30 echo "guile --use-srfi=1,10 fails to run"
31 exit 1
32 fi
33
34
35 # Test that running "guile --use-srfi=1" leaves the interactive REPL with
36 # the srfi-1 version of iota.
37 #
38 # In guile 1.8.1 and earlier, and 1.6.8 and earlier, these failed because in
39 # `top-repl' the core bindings got ahead of anything --use-srfi gave.
40 #
41
42 guile -q --use-srfi=1 >/dev/null <<EOF
43 (catch #t
44 (lambda ()
45 (iota 2 3 4))
46 (lambda args
47 (exit 1))) ;; bad
48 (exit 0) ;; good
49 EOF
50 if test $? = 0; then :; else
51 echo "guile --use-srfi=1 doesn't give SRFI-1 iota"
52 exit 1
53 fi
54
55
56 # Similar test on srfi-17 car, which differs in being a #:replacement. This
57 # exercises duplicates handling in `top-repl' versus `use-srfis' (in
58 # boot-9.scm).
59 #
60 guile -q --use-srfi=17 >/dev/null <<EOF
61 (if (procedure-with-setter? car)
62 (exit 0) ;; good
63 (exit 1)) ;; bad
64 EOF
65 if test $? = 0; then :; else
66 echo "guile --use-srfi=17 doesn't give SRFI-17 car"
67 exit 1
68 fi