Fix make-array transforms.
[sbcl.git] / tests / toplevel.test.sh
1 #!/bin/sh
2
3 # tests related to the toplevel interface: command line parsing
4 # and outer REPL
5
6 # This software is part of the SBCL system. See the README file for
7 # more information.
8 #
9 # While most of SBCL is derived from the CMU CL system, the test
10 # files (like this one) were written from scratch after the fork
11 # from CMU CL.
12 #
13 # This software is in the public domain and is provided with
14 # absolutely no warranty. See the COPYING and CREDITS files for
15 # more information.
16
17 . ./subr.sh
18
19 use_test_subdirectory
20
21 # Until sbcl-0.pre8, all --eval arguments were parsed before any of
22 # them were executed, making it impossible for --eval forms to refer
23 # to packages created by --eval forms.
24 run_sbcl --eval "(defpackage :foo)" --eval "(print 'foo::bar)" \
25   < /dev/null > $TEST_FILESTEM
26 if [ "`grep -c FOO::BAR $TEST_FILESTEM`" != 1 ] ; then
27     echo failed DEFPACKAGE-then-PRINT from --eval form
28     exit $EXIT_LOSE
29 fi
30
31 # --quit
32 run_sbcl --eval "(defpackage :foo)" --eval "(print 'foo::bar)" --quit \
33     > $TEST_FILESTEM
34 if [ "`grep -c FOO::BAR $TEST_FILESTEM`" != 1 ] ; then
35     echo failed DEFPACKAGE-then-PRINT with --quit
36     exit $EXIT_LOSE
37 fi
38 # --quit gets delayed
39 run_sbcl --eval "(defpackage :foo)" --quit --eval "(print 'foo::bar)" \
40     > $TEST_FILESTEM
41 if [ "`grep -c FOO::BAR $TEST_FILESTEM`" != 1 ] ; then
42     echo failed DEFPACKAGE-then-PRINT with delayed --quit
43     exit $EXIT_LOSE
44 fi
45
46 # --non-interactive
47 run_sbcl --eval "(defpackage :foo)" \
48     --non-interactive \
49     --eval "(print 'foo::bar)" \
50     > $TEST_FILESTEM
51 if [ "`grep -c FOO::BAR $TEST_FILESTEM`" != 1 ] ; then
52     echo failed DEFPACKAGE-then-PRINT with --non-interactive
53     exit $EXIT_LOSE
54 fi
55
56 # disable the use of --disable-debugger through run_sbcl for the rest of
57 # this file
58 SBCL_ARGS="--noinform --no-sysinit --no-userinit --noprint"
59
60 # --non-interactive with error
61 #
62 # (This test would hang if --non-interactive did not work properly.)
63 run_sbcl --eval "(defpackage :foo)" \
64     --non-interactive \
65     --eval "(print 'foo::bar)" \
66     --eval '(error "fail-safe")' \
67     >$TEST_FILESTEM 2>&1
68 if [ "`grep -c FOO::BAR $TEST_FILESTEM`" != 1 ] ; then
69     echo failed DEFPACKAGE-then-PRINT with --non-interactive and error
70     exit $EXIT_LOSE
71 fi
72 if [ "`grep -c -i SIMPLE-ERROR $TEST_FILESTEM`" -lt 1 ] ; then
73     echo no error seen in --non-interactive test
74     exit $EXIT_LOSE
75 fi
76
77 exit $EXIT_TEST_WIN