temporarily disable elisp exception tests
[bpt/guile.git] / examples / check.test
1 #!/bin/sh
2
3 # must be run from this directory
4 guile=${GUILE-../libguile/guile}
5 if [ -x $guile ] ; then
6 :
7 else
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
12 fi
13
14 if test "X$srcdir" = X; then
15 srcdir=.
16 fi
17
18 set -e
19
20 #
21 # simple-hello.scm
22 #
23 $guile -s $srcdir/scripts/simple-hello.scm > TMP
24 cat <<EOF | diff -u - TMP
25 Hello, World!
26 EOF
27 rm -f TMP
28
29 #
30 # hello
31 #
32 $guile -s $srcdir/scripts/hello > TMP
33 echo "Hello, World!" | diff -u - TMP
34 rm -f TMP
35
36 $guile -s $srcdir/scripts/hello --version > TMP
37 echo "hello 0.0.1" | diff -u - TMP
38 rm -f TMP
39
40 $guile -s $srcdir/scripts/hello --help > TMP
41 cat <<EOF | diff -u - TMP
42 Usage: hello [options...]
43 --help, -h Show this usage information
44 --version, -v Show version information
45 EOF
46 rm -f TMP
47
48 #
49 # fact
50 #
51 case `$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
58 cat <<EOF | diff -u - TMP
59 #<box #f>
60 EOF
61 rm -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
67 cat <<EOF | diff -u - TMP
68 #<box #f>
69 #<box 1>
70 EOF
71 rm -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
77 cat <<EOF | diff -u - TMP
78 #<box #f>
79 #<box 1>
80 1
81 EOF
82 rm -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
90 cat <<EOF | diff -u - TMP
91 #<box #f>
92 EOF
93 rm -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
99 cat <<EOF | diff -u - TMP
100 #<box #f>
101 #<box 1>
102 EOF
103 rm -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
109 cat <<EOF | diff -u - TMP
110 #<box #f>
111 #<box 1>
112 1
113 EOF
114 rm -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
121 cat <<EOF | diff -u - TMP
122 #<box #f>
123 EOF
124 rm -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
130 cat <<EOF | diff -u - TMP
131 #<box #f>
132 #<box 1>
133 EOF
134 rm -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
140 cat <<EOF | diff -u - TMP
141 #<box #f>
142 #<box 1>
143 1
144 EOF
145 rm -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
153 cat <<EOF | diff -u - TMP
154 #<box #f>
155 EOF
156 rm -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
163 cat <<EOF | diff -u - TMP
164 #<box #f>
165 #<box 1>
166 EOF
167 rm -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
174 cat <<EOF | diff -u - TMP
175 #<box #f>
176 #<box 1>
177 1
178 EOF
179 rm -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
186 cat <<EOF | diff -u - TMP
187 (#<box 1> #<box 2> #<box 3>)
188 (#<box 2> #<box 3> #<box 4>)
189 EOF
190 rm -f TMP
191
192
193
194 #
195 # ./main test
196 #
197 $guile -L $srcdir/modules -s $srcdir/modules/main > TMP
198 cat <<EOF | diff -u - TMP
199 module-0 foo
200 module-0 bar
201 module-1 foo
202 module-1 bar
203 module-2 braz
204 module-2 braz
205 module-2 foo
206 EOF
207 rm -f TMP
208
209
210 #
211 # ./safe untrusted.scm
212 #
213 $guile -s $srcdir/safe/safe $srcdir/safe/untrusted.scm > TMP
214 cat <<EOF | diff -u - TMP
215 1
216 1
217 2
218 6
219 24
220 120
221 720
222 5040
223 40320
224 362880
225 3628800
226 EOF
227 rm -f TMP
228
229 #
230 # ./safe evil.scm
231 #
232 $guile -s $srcdir/safe/safe $srcdir/safe/evil.scm > TMP
233 cat <<EOF | diff -u - TMP
234 ** Exception: (unbound-variable #f "Unbound variable: ~S" (open-input-file) #f)
235 EOF
236 rm -f TMP
237
238 # check.test ends here