9d57c0082e94ec2b6cafd94edf01ea045fcef69f
[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
7 here=`pwd`;
8
9 # ensure that top_srcdir is absolute
10 cd $top_srcdir; top_srcdir=`pwd`
11
12 export STAT_CONFIG_PATH=$top_srcdir/config
13
14
15 cleanup()
16 {
17      rm -rf $TEMPDIR
18 }
19
20
21 fail()
22 {
23     echo $activity
24     echo FAILED
25     cleanup;
26     exit 1;
27 }
28
29
30 no_result()
31 {
32     echo $activity
33     echo NO RESULT;
34     cleanup;
35     exit 2;
36 }
37
38 pass()
39 {
40     cleanup;
41     exit 0;
42 }
43
44 mkdir -p $TEMPDIR
45
46 cd $TEMPDIR
47
48 activity="create program 1"
49 cat > $TEMPDIR/tabs.stat <<EOF
50 data list /x 1-80 (a).
51 begin data.
52 EOF
53 if [ $? -ne 0 ] ; then no_result ; fi
54
55 activity="create program 2"
56 printf  "\t1\t12\t123\t1234\t12345\t123456\t\t1234567\t12345678\tasdf\tjkl\n" >> $TEMPDIR/tabs.stat
57 if [ $? -ne 0 ] ; then no_result ; fi
58
59
60 activity="create program 3"
61 cat >> $TEMPDIR/tabs.stat <<EOF
62 end data.
63 print /x.
64 execute.
65 EOF
66 if [ $? -ne 0 ] ; then no_result ; fi
67
68
69 activity="run program"
70 $SUPERVISOR $here/../src/pspp -o raw-ascii $TEMPDIR/tabs.stat
71 if [ $? -ne 0 ] ; then no_result ; fi
72
73
74 diff -B -b $TEMPDIR/pspp.list - << EOF
75 1.1 DATA LIST.  Reading 1 record from the command file.
76 +--------+------+-------+------+
77 |Variable|Record|Columns|Format|
78 #========#======#=======#======#
79 |X       |     1|  1- 80|A80   |
80 +--------+------+-------+------+
81         1       12      123     1234    12345   123456          1234567 12345678 
82 EOF
83 if [ $? -ne 0 ] ; then fail ; fi
84
85 pass;