tests: Convert variable display tests to Autotest framework.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 9 Oct 2010 14:03:57 +0000 (07:03 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 9 Oct 2010 14:03:57 +0000 (07:03 -0700)
tests/automake.mk
tests/command/variable-display.sh [deleted file]
tests/language/dictionary/variable-display.at [new file with mode: 0644]

index 62a8937e87ed77ee69b0acfddb0170fe898e17b9..e614c1bd1161690d21019265fe7b162af1d9710b 100644 (file)
@@ -10,7 +10,6 @@ TESTS_ENVIRONMENT += LC_ALL=C
 TESTS_ENVIRONMENT += EXEEXT=$(EXEEXT)
 
 dist_TESTS = \
-       tests/command/variable-display.sh \
        tests/command/vector.sh \
        tests/command/very-long-strings.sh \
        tests/command/weight.sh \
@@ -337,6 +336,7 @@ TESTSUITE_AT = \
        tests/language/dictionary/rename-variables.at \
        tests/language/dictionary/split-file.at \
        tests/language/dictionary/sys-file-info.at \
+       tests/language/dictionary/variable-display.at \
        tests/language/expressions/evaluate.at \
        tests/language/lexer/variable-parser.at \
        tests/language/stats/aggregate.at \
diff --git a/tests/command/variable-display.sh b/tests/command/variable-display.sh
deleted file mode 100755 (executable)
index fece96e..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/sh
-
-# This program tests variable display attribute commands: VARIABLE
-# ALIGNMENT, VARIABLE WIDTH, VARIABLE LEVEL.
-
-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
-
-# Create command file.
-activity="create program"
-cat > $TESTFILE << EOF
-data list free /x y z.
-variable alignment x (left)/y (right)/z (center).
-variable width x (10)/y (12)/z (14).
-variable level x (scale)/y (ordinal)/z (nominal).
-display dictionary.
-EOF
-if [ $? -ne 0 ] ; then no_result ; fi
-
-
-activity="run program"
-$SUPERVISOR $PSPP -o pspp.csv $TESTFILE
-if [ $? -ne 0 ] ; then fail ; fi
-
-activity="compare output"
-diff -c $TEMPDIR/pspp.csv - << EOF
-Variable,Description,,Position
-x,Format: F8.2,,1
-,Measure: Scale,,
-,Display Alignment: Left,,
-,Display Width: 10,,
-y,Format: F8.2,,2
-,Measure: Ordinal,,
-,Display Alignment: Right,,
-,Display Width: 12,,
-z,Format: F8.2,,3
-,Measure: Nominal,,
-,Display Alignment: Center,,
-,Display Width: 14,,
-EOF
-if [ $? -ne 0 ] ; then fail ; fi
-
-pass;
diff --git a/tests/language/dictionary/variable-display.at b/tests/language/dictionary/variable-display.at
new file mode 100644 (file)
index 0000000..6f527a7
--- /dev/null
@@ -0,0 +1,27 @@
+AT_BANNER([variable display attributes])
+
+AT_SETUP([variable display attribute commands])
+AT_DATA([var-display.sps], [dnl
+DATA LIST FREE /x y z.
+VARIABLE ALIGNMENT x (LEFT)/y (RIGHT)/z (CENTER).
+VARIABLE WIDTH x (10)/y (12)/z (14).
+VARIABLE LEVEL x (SCALE)/y (ORDINAL)/z (NOMINAL).
+DISPLAY DICTIONARY.
+])
+AT_CHECK([pspp -o pspp.csv var-display.sps])
+AT_CHECK([cat pspp.csv], [0], [dnl
+Variable,Description,,Position
+x,Format: F8.2,,1
+,Measure: Scale,,
+,Display Alignment: Left,,
+,Display Width: 10,,
+y,Format: F8.2,,2
+,Measure: Ordinal,,
+,Display Alignment: Right,,
+,Display Width: 12,,
+z,Format: F8.2,,3
+,Measure: Nominal,,
+,Display Alignment: Center,,
+,Display Width: 14,,
+])
+AT_CLEANUP