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/>.
17 AT_BANNER([command parser])
19 AT_SETUP([command parser negative tests])
20 AT_DATA([command.sps], [dnl
26 AT_CHECK([pspp command.sps], [1], [dnl
27 command.sps:1.1-1.6: error: Unknown command `DATA X'.
31 command.sps:2.1-2.5: error: Unknown command `XYZZY'.
35 command.sps:3.1-3.16: error: Unknown command `CLOSE FILE XYZZY'.
39 command.sps:4.1-4.3: error: Unknown command `foo'.
45 dnl Tests for a bug which crashed pspp when given certain invalid input.
46 AT_SETUP([command parser crash bug])
47 AT_DATA([command.sps], [dnl
51 AT_CHECK([pspp -O format=csv command.sps], [1], [dnl
52 "command.sps:1.1-1.12: error: Unknown command `DATA rubbish'.
56 "command.sps:2.1-2.7: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
62 dnl Tests for a bug where FINISH or EXIT wasn't executed until the lexer
63 dnl read the first token of the next command.
65 dnl (If this recurs, the test will run forever.)
66 AT_SETUP([FINISH executes immediately])
67 AT_CHECK([(echo "FINISH."; while echo ; do true; done) | pspp], [0], [ignore], [ignore])
72 AT_SETUP([ERASE -- safer mode])
73 AT_DATA([foobar], [contents
75 AT_DATA([erase.sps], [dnl
80 AT_CHECK([pspp -O format=csv erase.sps], [1], [dnl
81 "erase.sps:3.1-3.5: error: ERASE: This command not allowed when the SAFER option is set.
82 3 | erase FILE='foobar'.
85 AT_CHECK([cat foobar], [0], [contents
89 AT_SETUP([ERASE -- not safer mode])
90 AT_DATA([foobar], [contents
92 AT_CHECK([test -e foobar])
93 AT_DATA([erase.sps], [dnl
96 AT_CHECK([pspp -O format=csv erase.sps])
97 AT_CHECK([test ! -e foobar])
100 AT_BANNER([N OF CASES])
102 AT_SETUP([N OF CASES])
103 AT_DATA([n-of-cases.sps], [dnl
116 AT_CHECK([pspp -O format=csv n-of-cases.sps], [0], [dnl
139 dnl Tests for a bug wherein a comment just before end-of-file caused an
141 AT_SETUP([COMMENT at end of file])
142 AT_DATA([comment.sps], [dnl
143 COMMENT this is a comment at end of file.
145 AT_CHECK([pspp -O format=csv comment.sps])