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([DELETE VARIABLES])
19 dnl Checks for regressions against a crash reported in bug #38843.
20 AT_SETUP([DELETE VARIABLES with FILTER])
21 AT_DATA([delete-variables.sps], [dnl
33 AT_CHECK([pspp -O format=csv delete-variables.sps], [0], [dnl
34 Table: Reading free-form data from INLINE.
47 dnl Checks for regression against a crash reported on pspp-users:
48 dnl https://lists.gnu.org/archive/html/pspp-users/2021-03/msg00025.html
49 AT_SETUP([DELETE VARIABLES with string variables])
50 AT_DATA([delete-variables.sps], [dnl
51 DATA LIST NOTABLE /s1 TO s2 1-2(A).
59 AT_CHECK([pspp -O format=csv delete-variables.sps], [0], [dnl
66 dnl Checks for regression against a crash by Frans Houuweling
68 AT_SETUP([DELETE VARIABLES crash])
69 AT_DATA([delete-variables.sps], [dnl
70 DATA LIST NOTABLE LIST
71 /ID (A8) respondent_city_of_birth (A25) respondent_name (A20) respondent_surname (A30) respondent_year_of_birth (F4.0).
73 195 Amsterdam Floris "van Gelder" 1958
78 MATCH FILES FILE= * /KEEP = ID TO respondent_name ALL.
80 DELETE VARIABLES respondent_surname found .
83 AT_CHECK([pspp --testing-mode -O format=csv delete-variables.sps], [0], [dnl
85 ID,respondent_city_of_birth,respondent_name,respondent_year_of_birth,varlist
86 195,Amsterdam,Floris,1958,
90 AT_SETUP([DELETE VARIABLES syntax errors])
91 AT_DATA([delete-variables.sps], [dnl
92 DATA LIST LIST NOTABLE /x y z.
96 DELETE VARIABLES x y z.
102 AT_DATA([insert.sps], [dnl
103 INSERT FILE='delete-variables.sps' ERROR=IGNORE.
105 AT_CHECK([pspp --testing-mode -O format=csv insert.sps], [1], [dnl
106 "delete-variables.sps:5.1-5.22: error: DELETE VARIABLES: DELETE VARIABLES may not be used to delete all variables from the active dataset dictionary. Use NEW FILE instead.
107 5 | DELETE VARIABLES x y z.
108 | ^~~~~~~~~~~~~~~~~~~~~~"
110 "delete-variables.sps:7.1-7.16: error: DELETE VARIABLES: DELETE VARIABLES may not be used after TEMPORARY.
111 7 | DELETE VARIABLES x.
114 "delete-variables.sps:9.1-9.16: error: DELETE VARIABLES: DELETE VARIABLES may not be used when there are pending transformations (use EXECUTE to execute transformations).
115 9 | DELETE VARIABLES x.