1.0.45.30: wrap --script loading in a WITH-COMPILATION-UNIT
[sbcl.git] / tests / script.test.sh
1 #!/bin/sh
2
3 # tests related to --script
4
5 # This software is part of the SBCL system. See the README file for
6 # more information.
7 #
8 # While most of SBCL is derived from the CMU CL system, the test
9 # files (like this one) were written from scratch after the fork
10 # from CMU CL.
11 #
12 # This software is in the public domain and is provided with
13 # absolutely no warranty. See the COPYING and CREDITS files for
14 # more information.
15
16 . ./subr.sh
17
18 use_test_subdirectory
19
20 tmpscript=$TEST_FILESTEM.lisp-script
21
22 echo '(quit :unix-status 7)' > $tmpscript
23 run_sbcl --script $tmpscript
24 check_status_maybe_lose "--script exit status from QUIT" $? 7 "(quit status good)"
25
26 echo '(error "oops")' > $tmpscript
27 run_sbcl --script $tmpscript
28 check_status_maybe_lose "--script exit status from ERROR" $? 1 "(error implies 1)"
29
30 echo 'nil'> $tmpscript
31 run_sbcl --script $tmpscript
32 check_status_maybe_lose "--script exit status from normal exit" $? 0 "(everything ok)"
33
34 echo '(setf *error-output* *standard-output*) (defun foo () (bar)) (defun bar () 11) (quit :unix-status (foo))'> $tmpscript
35 out=`run_sbcl --script $tmpscript`
36 check_status_maybe_lose "--script exit status from normal exit" $? 11 "(everything ok)"
37 test -z "$out"
38 check_status_maybe_lose "--script forward-referenced functions" $? 0 "(everything ok)"
39
40 rm -f $tmpscript
41
42 exit $EXIT_TEST_WIN