1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 dnl GNU General Public License for more details.
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19 dnl Create a file "batch.sps" that is valid syntax only in batch mode.
20 m4_define([CREATE_BATCH_SPS],
21 [AT_DATA([batch.sps], [dnl
31 AT_SETUP([INSERT SYNTAX=INTERACTIVE])
33 AT_DATA([insert.sps], [dnl
39 AT_CHECK([pspp -o pspp.csv insert.sps], [1], [dnl
40 batch.sps:2.1-2.4: error: INPUT PROGRAM: Syntax error expecting end of command.
43 batch.sps:3.4-3.10: error: COMPUTE: COMPUTE is allowed only after the active dataset has been defined or inside INPUT PROGRAM.
46 batch.sps:4.4-4.11: error: END CASE: END CASE is allowed only inside INPUT PROGRAM.
49 insert.sps:4.1-4.4: error: LIST: LIST is allowed only after the active dataset has been defined.
55 AT_SETUP([INSERT SYNTAX=BATCH])
57 AT_DATA([insert.sps], [dnl
63 AT_CHECK([pspp -o pspp.csv insert.sps])
64 AT_CHECK([cat pspp.csv], [0], [dnl
75 AT_SETUP([INSERT CD=NO])
76 AT_DATA([insert.sps], [INSERT FILE='Dir1/foo.sps'.
80 AT_DATA([Dir1/foo.sps], [INSERT FILE='bar.sps' CD=NO.
82 AT_DATA([Dir1/bar.sps],
90 AT_CHECK([pspp -o pspp.csv insert.sps], [1], [dnl
91 Dir1/foo.sps:1: error: INSERT: Can't find `bar.sps' in include file search path.
92 insert.sps:2.1-2.4: error: LIST: LIST is allowed only after the active dataset has been defined.
98 AT_SETUP([INSERT CD=YES])
99 AT_DATA([insert.sps], [INSERT FILE='Dir1/foo.sps' CD=YES.
103 AT_DATA([Dir1/foo.sps], [INSERT FILE='bar.sps'.
105 AT_DATA([Dir1/bar.sps],
106 [DATA LIST LIST /x *.
113 AT_CHECK([pspp -o pspp.csv insert.sps])
114 AT_CHECK([cat pspp.csv], [0], [dnl
115 Table: Reading free-form data from INLINE.
127 m4_define([CREATE_ERROR_SPS],
128 [AT_DATA([error.sps], [dnl
129 DATA LIST NOTABLE LIST /x *.
136 * The following line is erroneous
142 AT_SETUP([INSERT ERROR=STOP])
144 AT_DATA([insert.sps], [INSERT FILE='error.sps' ERROR=STOP.
146 AT_CHECK([pspp -o pspp.csv insert.sps], [1], [dnl
147 error.sps:10.9-10.13: error: DISPLAY: AKSDJ is not a variable name.
150 warning: Error encountered while ERROR=STOP is effective.
154 AT_SETUP([INSERT ERROR=CONTINUE])
156 AT_DATA([insert.sps], [INSERT FILE='error.sps' ERROR=CONTINUE.
158 AT_CHECK([pspp -o pspp.csv insert.sps], [1], [dnl
159 error.sps:10.9-10.13: error: DISPLAY: AKSDJ is not a variable name.
163 AT_CHECK([cat pspp.csv], [0], [dnl
164 "error.sps:10.9-10.13: error: DISPLAY: AKSDJ is not a variable name.
176 dnl Test for regression against bug #24569 in which PSPP crashed
177 dnl upon attempt to insert a nonexistent file.
178 AT_SETUP([INSERT nonexistent file])
179 AT_DATA([insert.sps], [dnl
187 AT_CHECK([pspp -O format=csv insert.sps], [1], [dnl
188 insert.sps:2: error: INSERT: Can't find `nonexistent' in include file search path.
190 "insert.sps:6.1-6.4: error: LIST: LIST is allowed only after the active dataset has been defined.
197 dnl A test to check the INCLUDE command complete with the
198 dnl syntax and function of the ENCODING subcommand.
199 AT_SETUP([INCLUDE full check])
200 AT_DATA([two-utf8.sps], [dnl
204 AT_DATA([include.sps], [dnl
207 include FILE='two-latin1.sps' ENCODING='ISO_8859-1'.
210 AT_CHECK([iconv -f UTF-8 -t iso-8859-1 two-utf8.sps > two-latin1.sps], [0], [])
212 AT_CHECK([pspp -O format=csv include.sps], [0], [dnl
222 dnl Test for a bug where insert crashed on an unterminated string input
223 AT_SETUP([INSERT unterminated string])
225 AT_DATA([insert.sps], [INSERT FILE=7bar.sps' CD=NO.
228 AT_CHECK([pspp -O format=csv insert.sps], [1], [ignore])