SYSFILE INFO: Get rid of nested tables.
[pspp] / tests / language / dictionary / sys-file-info.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
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.
8 dnl 
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.
13 dnl 
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/>.
16 dnl
17 AT_BANNER([SYSFILE INFO])
18
19 AT_SETUP([SYSFILE INFO])
20 AT_DATA([sysfile-info.sps], [dnl
21 DATA LIST LIST /x * name (a10) .
22 BEGIN DATA
23 1 one
24 2 two
25 3 three
26 END DATA.
27 SAVE OUTFILE='pro.sav'.
28
29 sysfile info file='pro.sav'.
30 ])
31 AT_CHECK([pspp -o pspp.csv sysfile-info.sps])
32 AT_CHECK([pspp -o pspp.pdf sysfile-info.sps])
33 AT_CHECK([pspp -o pspp.txt sysfile-info.sps])
34 AT_CHECK(
35   [sed -e '/^Created:,/d' \
36        -e '/^Endian:,/d' \
37        -e '/^Integer Format:,/d' \
38        -e '/^Real Format:,/d' \
39        -e '/^Encoding:,/d' pspp.csv],
40   [0], [dnl
41 Table: Reading free-form data from INLINE.
42 Variable,Format
43 x,F8.0
44 name,A10
45
46 File:,pro.sav
47 Label:,No label.
48 Variables:,2
49 Cases:,3
50 Type:,SPSS System File
51 Weight:,Not weighted.
52 Compression:,SAV
53
54 Table: Variables
55 Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
56 x,1,,Scale,Input,8,Right,F8.2,F8.2,
57 name,2,,Nominal,Input,10,Left,A10,A10,
58 ])
59 AT_CLEANUP
60
61 AT_BANNER([DISPLAY])
62
63 dnl DISPLAY DOCUMENTS is tested with commands for documents.
64
65 AT_SETUP([DISPLAY FILE LABEL])
66 AT_DATA([display.sps], [dnl
67 DATA LIST LIST NOTABLE /x * name (a10) .
68
69 DISPLAY FILE LABEL.
70
71 FILE LABEL 'foo bar baz quux'.
72 DISPLAY FILE LABEL.
73 ])
74 AT_CHECK([pspp -O format=csv display.sps], [0], [dnl
75 The active dataset does not have a file label.
76
77 File label: foo bar baz quux
78 ])
79 AT_CLEANUP
80
81 dnl DISPLAY VECTORS is tested with commands for vectors.
82
83 dnl DISPLAY ATTRIBUTES and @ATTRIBUTES are tested with commands for attributes.
84
85 AT_SETUP([DISPLAY SCRATCH])
86 AT_DATA([sysfile-info.sps], [dnl
87 DATA LIST LIST NOTABLE /x * name (a10) .
88 DISPLAY SCRATCH.
89 COMPUTE #x=0.
90 DISPLAY SCRATCH.
91 ])
92 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
93 sysfile-info.sps:2: warning: DISPLAY: No variables to display.
94
95 Table: Variables
96 Name
97 #x
98 ])
99 AT_CLEANUP
100
101 AT_SETUP([DISPLAY INDEX])
102 AT_DATA([sysfile-info.sps], [dnl
103 DATA LIST LIST NOTABLE /x * name (a10) .
104 DISPLAY INDEX.
105 ])
106 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
107 Table: Variables
108 Name,Position
109 x,1
110 name,2
111 ])
112 AT_CLEANUP
113
114 AT_SETUP([DISPLAY NAMES])
115 AT_DATA([sysfile-info.sps], [dnl
116 DATA LIST LIST NOTABLE /x * name (a10) .
117 DISPLAY NAMES.
118 ])
119 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
120 Table: Variables
121 Name
122 x
123 name
124 ])
125 AT_CLEANUP
126
127 AT_SETUP([DISPLAY LABELS])
128 AT_DATA([sysfile-info.sps], [dnl
129 DATA LIST LIST NOTABLE /x * name (a10) .
130 VARIABLE LABEL x 'variable one' name 'variable two'.
131 VALUE LABEL x 1 'asdf' 2 'jkl;'.
132 DISPLAY LABELS.
133 ])
134 AT_CHECK([pspp -O format=csv sysfile-info.sps], [0], [dnl
135 Table: Variables
136 Name,Position,Label
137 x,1,variable one
138 name,2,variable two
139 ])
140 AT_CLEANUP
141
142 dnl DISPLAY VARIABLES Is tested in multiple places.