temporarily disable elisp exception tests
[bpt/guile.git] / examples / check.test
CommitLineData
0ea47a3a
LC
1#!/bin/sh
2
3# must be run from this directory
4guile=${GUILE-../libguile/guile}
5if [ -x $guile ] ; then
6 :
7else
8 echo could not find guile interpreter.
9 echo '(are you running this script from' `dirname $0` '?)'
10 echo GUILE env var: ${GUILE-not set}
11 exit 1
12fi
13
14if test "X$srcdir" = X; then
15 srcdir=.
16fi
17
18set -e
19
20#
21# simple-hello.scm
22#
23$guile -s $srcdir/scripts/simple-hello.scm > TMP
24cat <<EOF | diff -u - TMP
25Hello, World!
26EOF
27rm -f TMP
28
29#
30# hello
31#
32$guile -s $srcdir/scripts/hello > TMP
33echo "Hello, World!" | diff -u - TMP
34rm -f TMP
35
36$guile -s $srcdir/scripts/hello --version > TMP
37echo "hello 0.0.1" | diff -u - TMP
38rm -f TMP
39
40$guile -s $srcdir/scripts/hello --help > TMP
41cat <<EOF | diff -u - TMP
42Usage: hello [options...]
43 --help, -h Show this usage information
44 --version, -v Show version information
45EOF
46rm -f TMP
47
48#
49# fact
50#
51case `$guile -s $srcdir/scripts/fact 5` in 120) ;; *) echo $0: error: fact 5 ;; esac
52
53
54#
55# ./box/box test #1
56#
57./box/box -c '(let ((b (make-box))) (display b) (newline))' > TMP
58cat <<EOF | diff -u - TMP
59#<box #f>
60EOF
61rm -f TMP
62
63#
64# ./box/box test #2
65#
66./box/box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline))' > TMP
67cat <<EOF | diff -u - TMP
68#<box #f>
69#<box 1>
70EOF
71rm -f TMP
72
73#
74# ./box/box test #3
75#
76./box/box -c '(let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline))' > TMP
77cat <<EOF | diff -u - TMP
78#<box #f>
79#<box 1>
801
81EOF
82rm -f TMP
83
84
85
86#
87# ./box-module/box test #1
88#
89./box-module/box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
90cat <<EOF | diff -u - TMP
91#<box #f>
92EOF
93rm -f TMP
94
95#
96# ./box-module/box test #2
97#
98./box-module/box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
99cat <<EOF | diff -u - TMP
100#<box #f>
101#<box 1>
102EOF
103rm -f TMP
104
105#
106# ./box-module/box test #3
107#
108./box-module/box -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
109cat <<EOF | diff -u - TMP
110#<box #f>
111#<box 1>
1121
113EOF
114rm -f TMP
115
116
117#
118# ./box-dynamic/box test #1
119#
120$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline)))' > TMP
121cat <<EOF | diff -u - TMP
122#<box #f>
123EOF
124rm -f TMP
125
126#
127# ./box-dynamic/box test #2
128#
129$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
130cat <<EOF | diff -u - TMP
131#<box #f>
132#<box 1>
133EOF
134rm -f TMP
135
136#
137# ./box-dynamic/box test #3
138#
139$guile -c '(begin (load-extension "libbox" "scm_init_box") (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
140cat <<EOF | diff -u - TMP
141#<box #f>
142#<box 1>
1431
144EOF
145rm -f TMP
146
147
148#
149# ./box-dynamic-module/box test #1
150#
151$guile -L $srcdir/box-dynamic-module \
152 -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline)))' > TMP
153cat <<EOF | diff -u - TMP
154#<box #f>
155EOF
156rm -f TMP
157
158#
159# ./box-dynamic-module/box test #2
160#
161$guile -L $srcdir/box-dynamic-module \
162 -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline)))' > TMP
163cat <<EOF | diff -u - TMP
164#<box #f>
165#<box 1>
166EOF
167rm -f TMP
168
169#
170# ./box-dynamic-module/box test #3
171#
172$guile -L $srcdir/box-dynamic-module \
173 -c '(begin (use-modules (box-module)) (let ((b (make-box))) (display b) (newline) (box-set! b 1) (display b) (newline) (display (box-ref b)) (newline)))' > TMP
174cat <<EOF | diff -u - TMP
175#<box #f>
176#<box 1>
1771
178EOF
179rm -f TMP
180
181#
182# ./box-dynamic-module/box test #4
183#
184$guile -L $srcdir/box-dynamic-module \
185 -c '(begin (use-modules (box-mixed)) (let ((b (make-box-list 1 2 3))) (display b) (newline) (display (box-map 1+ b)) (newline)))' > TMP
186cat <<EOF | diff -u - TMP
187(#<box 1> #<box 2> #<box 3>)
188(#<box 2> #<box 3> #<box 4>)
189EOF
190rm -f TMP
191
192
193
194#
195# ./main test
196#
197$guile -L $srcdir/modules -s $srcdir/modules/main > TMP
198cat <<EOF | diff -u - TMP
199module-0 foo
200module-0 bar
201module-1 foo
202module-1 bar
203module-2 braz
204module-2 braz
205module-2 foo
206EOF
207rm -f TMP
208
209
210#
211# ./safe untrusted.scm
212#
213$guile -s $srcdir/safe/safe $srcdir/safe/untrusted.scm > TMP
214cat <<EOF | diff -u - TMP
2151
2161
2172
2186
21924
220120
221720
2225040
22340320
224362880
2253628800
226EOF
227rm -f TMP
228
229#
230# ./safe evil.scm
231#
232$guile -s $srcdir/safe/safe $srcdir/safe/evil.scm > TMP
233cat <<EOF | diff -u - TMP
234** Exception: (unbound-variable #f "Unbound variable: ~S" (open-input-file) #f)
235EOF
236rm -f TMP
237
238# check.test ends here