Fix use of "export" to work with traditional shells.
[pspp-builds.git] / tests / command / tabs.sh
1 #!/bin/sh
2
3 # This program tests that tab characters can be used in string input
4
5 TEMPDIR=/tmp/pspp-tst-$$
6 TESTFILE=$TEMPDIR/`basename $0`.sps
7
8 here=`pwd`;
9
10 # ensure that top_srcdir is absolute
11 cd $top_srcdir; top_srcdir=`pwd`
12
13 STAT_CONFIG_PATH=$top_srcdir/config
14 export STAT_CONFIG_PATH
15
16
17 cleanup()
18 {
19      rm -rf $TEMPDIR
20 }
21
22
23 fail()
24 {
25     echo $activity
26     echo FAILED
27     cleanup;
28     exit 1;
29 }
30
31
32 no_result()
33 {
34     echo $activity
35     echo NO RESULT;
36     cleanup;
37     exit 2;
38 }
39
40 pass()
41 {
42     cleanup;
43     exit 0;
44 }
45
46 mkdir -p $TEMPDIR
47
48 cd $TEMPDIR
49
50 activity="create program 1"
51 cat > $TEMPDIR/tabs.stat <<EOF
52 data list /X 1-80 (a).
53 begin data.
54 EOF
55 if [ $? -ne 0 ] ; then no_result ; fi
56
57 activity="create program 2"
58 printf  "\t1\t12\t123\t1234\t12345\n" >> $TEMPDIR/tabs.stat
59 if [ $? -ne 0 ] ; then no_result ; fi
60
61
62 activity="create program 3"
63 cat >> $TEMPDIR/tabs.stat <<EOF
64 end data.
65 print /x.
66 execute.
67 EOF
68 if [ $? -ne 0 ] ; then no_result ; fi
69
70
71 activity="run program"
72 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/tabs.stat
73 if [ $? -ne 0 ] ; then no_result ; fi
74
75
76 diff -B -b $TEMPDIR/pspp.list - << EOF
77 1.1 DATA LIST.  Reading 1 record from the command file.
78 +--------+------+-------+------+
79 |Variable|Record|Columns|Format|
80 #========#======#=======#======#
81 |X       |     1|  1- 80|A80   |
82 +--------+------+-------+------+
83     1   12  123 1234    12345
84 EOF
85 if [ $? -ne 0 ] ; then fail ; fi
86
87 pass;