SAVE: Convert test for non-empty case map to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 04:29:54 +0000 (21:29 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 04:29:54 +0000 (21:29 -0700)
tests/automake.mk
tests/bugs/case-map.sh [deleted file]
tests/data/sys-file.at

index 0e563c0c82a31ae284ab241283d73be04ad7f018..e9c78ae1e0c7d31c1d407791896ef898976671f1 100644 (file)
@@ -27,7 +27,6 @@ dist_TESTS = \
        tests/formats/wkday-in.sh \
        tests/formats/wkday-out.sh \
        tests/formats/360.sh \
-       tests/bugs/case-map.sh \
        tests/bugs/comment-at-eof.sh \
        tests/bugs/compression.sh \
        tests/bugs/curtailed.sh \
diff --git a/tests/bugs/case-map.sh b/tests/bugs/case-map.sh
deleted file mode 100755 (executable)
index ed10bff..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-
-# This program tests for a bug which caused a crash when
-# a non-empty case_map was created in SAVE.
-
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_builddir  are absolute
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-top_builddir=`cd $top_builddir; pwd`
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-# ensure that top_srcdir is absolute
-top_srcdir=`cd $top_srcdir; pwd`
-
-STAT_CONFIG_PATH=$top_srcdir/config
-export STAT_CONFIG_PATH
-
-
-cleanup()
-{
-     if [ x"$PSPP_TEST_NO_CLEANUP" != x ] ; then 
-       echo "NOT cleaning $TEMPDIR" 
-       return ; 
-     fi
-     cd /
-     rm -rf $TEMPDIR
-}
-
-
-fail()
-{
-    echo $activity
-    echo FAILED
-    cleanup;
-    exit 1;
-}
-
-
-no_result()
-{
-    echo $activity
-    echo NO RESULT;
-    cleanup;
-    exit 2;
-}
-
-pass()
-{
-    cleanup;
-    exit 0;
-}
-
-mkdir -p $TEMPDIR
-
-cd $TEMPDIR
-
-activity="create program"
-cat > $TESTFILE <<EOF
-INPUT PROGRAM.
-    COMPUTE #I = 1.
-    COMPUTE X = #I.
-    END CASE.
-    END FILE.
-END INPUT PROGRAM.
-
-SAVE OUTFILE='tiny.sav'.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv -e /dev/null $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
index 4021b6de3f742f22d487a914187da728c5d2e090..e82166c9054c378e24933a35cb07e4e24d4de0e1 100644 (file)
@@ -37,6 +37,29 @@ variable001,variable002,variable003,variable004
 ])
 AT_CLEANUP
 
+AT_SETUP([nonempty case_map doesn't crash])
+AT_DATA([save.sps], [dnl
+INPUT PROGRAM.
+    COMPUTE #I = 1.
+    COMPUTE X = #I + 1.
+    END CASE.
+    END FILE.
+END INPUT PROGRAM.
+
+SAVE OUTFILE='tiny.sav'.
+])
+AT_CHECK([pspp -O format=csv save.sps])
+AT_DATA([get.sps], [dnl
+GET FILE='tiny.sav'.
+LIST.
+])
+AT_CHECK([pspp -O format=csv get.sps], [0], [dnl
+Table: Data List
+X
+2.00
+])
+AT_CLEANUP
+
 # Test that system files can be read properly, even when the case_size
 # header value is -1 (Some 3rd party products do this).
 AT_SETUP([system files with -1 case_size])