3 # This program tests the INSERT command
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
8 # ensure that top_srcdir and top_builddir are absolute
9 if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
10 if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
11 top_srcdir=`cd $top_srcdir; pwd`
12 top_builddir=`cd $top_builddir; pwd`
14 PSPP=$top_builddir/src/ui/terminal/pspp
16 STAT_CONFIG_PATH=$top_srcdir/config
17 export STAT_CONFIG_PATH
25 if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then
26 echo "NOT cleaning $TEMPDIR"
60 activity="create wrapper 1"
63 FILE='$TEMPDIR/foo.sps'
71 if [ $? -ne 0 ] ; then no_result ; fi
73 #The following syntax intentionally omits periods from some lines
74 #It's an example of "batch" syntax
75 activity="create insert"
76 cat <<EOF > $TEMPDIR/foo.sps
86 if [ $? -ne 0 ] ; then no_result ; fi
89 #This command should fail
90 activity="run program 1"
91 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
92 if [ $? -eq 0 ] ; then fail ; fi
95 activity="create wrapper 2"
98 FILE='$TEMPDIR/foo.sps'
106 if [ $? -ne 0 ] ; then no_result ; fi
108 activity="run program 2"
109 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
110 if [ $? -ne 0 ] ; then fail ; fi
113 # Now test the CD subcommand
117 if [ $? -ne 0 ] ; then no_result ; fi
119 activity="create wrapper 3"
120 cat <<EOF > $TESTFILE
122 FILE='$TEMPDIR/Dir1/foo.sps'
130 if [ $? -ne 0 ] ; then no_result ; fi
132 activity="create wrapper 4"
133 cat <<EOF > $TEMPDIR/Dir1/foo.sps
140 if [ $? -ne 0 ] ; then no_result ; fi
142 activity="create wrapper 5"
143 cat <<EOF > $TEMPDIR/Dir1/bar.sps
152 if [ $? -ne 0 ] ; then no_result ; fi
155 # This command should fail
156 activity="run program 3"
157 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
158 if [ $? -eq 0 ] ; then fail ; fi
160 activity="create wrapper 6"
161 cat <<EOF > $TESTFILE
163 FILE='$TEMPDIR/Dir1/foo.sps'
170 if [ $? -ne 0 ] ; then no_result ; fi
172 activity="run program 4"
173 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE
174 if [ $? -ne 0 ] ; then fail ; fi
177 # Now test the ERROR= feature
179 activity="create wrapper 7"
180 cat <<EOF > $TESTFILE
182 FILE='$TEMPDIR/foo.sps'
189 if [ $? -ne 0 ] ; then no_result ; fi
192 activity="create included file"
193 cat <<EOF > $TEMPDIR/foo.sps
194 DATA LIST NOTABLE LIST /x *.
201 * The following line is erroneous
206 if [ $? -ne 0 ] ; then no_result ; fi
208 activity="run program 5"
209 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
210 if [ $? -ne 1 ] ; then no_result ; fi
212 activity="examine output 1"
213 diff $TEMPDIR/pspp.list - <<EOF
214 $TEMPDIR/foo.sps:10: error: DISPLAY: AKSDJ is not a variable name.
215 warning: Error encountered while ERROR=STOP is effective.
216 $TEMPDIR/foo.sps:10: error: Stopping syntax file processing here to avoid a cascade of dependent command failures.
219 if [ $? -ne 0 ] ; then fail ; fi
222 activity="create wrapper 8"
223 cat <<EOF > $TESTFILE
225 FILE='$TEMPDIR/foo.sps'
232 if [ $? -ne 0 ] ; then no_result ; fi
234 activity="run program 6"
235 $SUPERVISOR $PSPP --testing-mode -o raw-ascii $TESTFILE > /dev/null
236 if [ $? -ne 1 ] ; then no_result ; fi
238 activity="examine output 2"
239 diff $TEMPDIR/pspp.list - <<EOF
240 $TEMPDIR/foo.sps:10: error: DISPLAY: AKSDJ is not a variable name.
249 if [ $? -ne 0 ] ; then fail ; fi