tests: Convert test for #! support to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 21:09:06 +0000 (14:09 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 10 Oct 2010 21:09:06 +0000 (14:09 -0700)
tests/automake.mk
tests/bugs/shbang.sh [deleted file]
tests/language/lexer/lexer.at [new file with mode: 0644]

index fc6a2cb0b0fd442d938411efcd3f5f654b141452..90b76d9bd692a75ab56fed07f488fe7fcd2913d7 100644 (file)
@@ -27,7 +27,6 @@ dist_TESTS = \
        tests/formats/wkday-in.sh \
        tests/formats/wkday-out.sh \
        tests/formats/360.sh \
-       tests/bugs/shbang.sh \
        tests/bugs/signals.sh \
        tests/bugs/temporary.sh \
        tests/bugs/unwritable-dir.sh \
@@ -325,6 +324,7 @@ TESTSUITE_AT = \
        tests/language/dictionary/weight.at \
        tests/language/expressions/evaluate.at \
        tests/language/expressions/parse.at \
+       tests/language/lexer/lexer.at \
        tests/language/lexer/q2c.at \
        tests/language/lexer/variable-parser.at \
        tests/language/stats/aggregate.at \
diff --git a/tests/bugs/shbang.sh b/tests/bugs/shbang.sh
deleted file mode 100755 (executable)
index 607e4a7..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/bin/sh
-
-# This program tests that PSPP ignores the first line of a PSPP syntax
-# file that begins with #!, without issuing an error (bug #26518).
-
-TEMPDIR=/tmp/pspp-tst-$$
-TESTFILE=$TEMPDIR/`basename $0`.sps
-
-# ensure that top_srcdir and top_builddir  are absolute
-if [ -z "$top_srcdir" ] ; then top_srcdir=. ; fi
-if [ -z "$top_builddir" ] ; then top_builddir=. ; fi
-top_srcdir=`cd $top_srcdir; pwd`
-top_builddir=`cd $top_builddir; pwd`
-
-PSPP=$top_builddir/src/ui/terminal/pspp$EXEEXT
-
-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
-
-cat > $TESTFILE << EOF
-#! $PSPP
-DATA LIST LIST NOTABLE /a.
-BEGIN DATA.
-1
-2
-END DATA.
-LIST.
-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
-
-
-activity="compare output"
-perl -pi -e 's/^\s*$//g' $TEMPDIR/pspp.csv
-diff -b  -w $TEMPDIR/pspp.csv - << EOF
-Table: Data List
-a
-1.00
-2.00
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-
-pass;
diff --git a/tests/language/lexer/lexer.at b/tests/language/lexer/lexer.at
new file mode 100644 (file)
index 0000000..2c1dfc9
--- /dev/null
@@ -0,0 +1,20 @@
+AT_BANNER([lexer])
+
+AT_SETUP([lexer ignores initial @%:@! line])
+AT_DATA([lexer.sps], [dnl
+#! /usr/local/bin/pspp
+DATA LIST LIST NOTABLE /a.
+BEGIN DATA.
+1
+2
+END DATA.
+LIST.
+])
+AT_CHECK([pspp -o pspp.csv lexer.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Table: Data List
+a
+1.00
+2.00
+])
+AT_CLEANUP