1 AT_BANNER([PRINT and WRITE])
3 dnl These tests check unusual aspects of the PRINT and WRITE
6 dnl - PRINT puts spaces between variables, unless a format
7 dnl is specified explicitly.
9 dnl - WRITE doesn't put space between variables.
11 dnl - PRINT to an external file prefixes each line with a space.
13 dnl - PRINT EJECT to an external file indicates a formfeed by a "1"
14 dnl in the first column.
16 dnl - WRITE writes out spaces for system-missing values, not a period.
18 dnl - When no output is specified, an empty record is output.
20 AT_SETUP([PRINT numeric variables])
21 AT_DATA([print.sps], [dnl
22 data list notable /x y 1-2.
38 AT_CHECK([pspp -O format=csv print.sps], [0], [dnl
91 AT_SETUP([PRINT string variables])
92 AT_DATA([print.sps], [dnl
93 DATA LIST FREE /s8 (a8) s10 (a10) vl255 (a255) vl258 (a258).
97 AbbbbMaryHadALittleLambbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbZ
98 AccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccZ
101 AmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmZ
102 AoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooWhyIsItSoZ
107 /s10 * vl255 * vl258 *.
111 AT_CHECK([pspp -O format=csv print.sps])
112 AT_CHECK([cat print.txt], [0], [dnl
113 AaaaaaaaaZ AbbbbMaryHadALittleLambbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbZ AccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccZ @&t@
114 AnnnnnnnnZ AmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmZ AoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooWhyIsItSoZ @&t@
118 AT_SETUP([PRINT to file])
119 AT_DATA([print.sps], [dnl
120 data list notable /x y 1-2.
129 print outfile='print.out' /x y.
130 print eject outfile='print.out' /x y (f1,f1).
131 print outfile='print.out' /x '-' y.
132 print outfile='print.out'.
136 AT_CHECK([pspp -O format=csv print.sps])
137 AT_CHECK([cat print.out], [0], [dnl
161 dnl Tests for a bug which crashed when deallocating after a bad PRINT
163 AT_SETUP([PRINT crash bug])
164 AT_DATA([print.sps], [dnl
165 DATA LIST LIST NOTABLE /a * b *.
174 AT_CHECK([pspp -O format=csv print.sps], [1], [dnl
175 print.sps:7.7-7.10: error: PRINT: Syntax error at `F8.2': expecting a valid subcommand.
184 AT_SETUP([WRITE to file])
185 AT_DATA([write.sps], [dnl
186 data list notable /x y 1-2.
195 write outfile='write.out' /x y.
196 write outfile='write.out' /x y (2(f1)).
197 write outfile='write.out' /x '-' y.
198 write outfile='write.out'.
202 AT_CHECK([pspp -O format=csv write.sps])
203 AT_CHECK([cat write.out], [0], [dnl
227 AT_SETUP([PRINT overwrites file])
228 AT_DATA([output.txt], [abcdef
230 AT_DATA([print.sps], [dnl
231 DATA LIST NOTABLE/x 1.
235 PRINT OUTFILE='output.txt'/x.
238 AT_CHECK([pspp -O format=csv print.sps])
239 AT_CHECK([cat output.txt], [0], [ 5 @&t@
243 AT_SETUP([PRINT overwrites file atomically])
244 AT_DATA([output.txt], [abcdef
247 [[DATA LIST NOTABLE/x 1.
251 PRINT OUTFILE='output.txt'/x.
252 HOST COMMAND=['kill -TERM $PPID'].
254 AT_CHECK([pspp -O format=csv print.sps], [143], [], [ignore])
255 AT_CHECK([cat output.txt], [0], [abcdef
258 [for file in *.tmp*; do if test -e $file; then echo $file; exit 1; fi; done])
261 AT_SETUP([PRINT to same file being read])
262 AT_DATA([data.txt], [5
264 AT_DATA([print.sps], [dnl
265 DATA LIST FILE='data.txt' NOTABLE/x 1.
267 PRINT OUTFILE='data.txt'/y.
270 AT_CHECK([pspp -O format=csv print.sps])
271 AT_CHECK([cat data.txt], [0], [ 6.00 @&t@
274 [for file in *.tmp*; do if test -e $file; then echo $file; exit 1; fi; done])
277 AT_SETUP([PRINT to special file])
278 AT_SKIP_IF([test ! -c /dev/null])
279 AT_CHECK([ln -s /dev/null foo.out || exit 77])
280 AT_SKIP_IF([test ! -c foo.out])
281 AT_DATA([print.sps], [dnl
282 DATA LIST NOTABLE /x 1.
290 PRINT OUTFILE='foo.out'/x.
291 PRINT OUTFILE='foo2.out'/x.
294 AT_CHECK([pspp -O format=csv print.sps])
295 AT_CHECK([cat foo2.out], [0], [dnl
302 ls -l foo.out foo2.out
303 AT_CHECK([test -c foo.out])