Change terminology from "active file" to "active dataset".
[pspp-builds.git] / tests / language / command.at
1 AT_BANNER([command parser])
2
3 dnl Tests for a bug which crashed pspp when given certain invalid input.
4 AT_SETUP([command parser crash bug])
5 AT_DATA([command.sps], [dnl
6 DATA rubbish.
7 EXECUTE.
8 ])
9 AT_CHECK([pspp -O format=csv command.sps], [1], [dnl
10 command.sps:1: error: Unknown command `DATA rubbish'.
11
12 command.sps:2: error: EXECUTE: EXECUTE is allowed only after the active dataset has been defined.
13 ])
14 AT_CLEANUP
15
16 AT_BANNER([ERASE])
17
18 AT_SETUP([ERASE -- safer mode])
19 AT_DATA([foobar], [contents
20 ])
21 AT_DATA([erase.sps], [dnl
22 set safer on
23
24 erase FILE='foobar'.
25 ])
26 AT_CHECK([pspp -O format=csv erase.sps], [1], [dnl
27 erase.sps:3: error: ERASE: This command not allowed when the SAFER option is set.
28 ])
29 AT_CHECK([cat foobar], [0], [contents
30 ])
31 AT_CLEANUP
32
33 AT_SETUP([ERASE -- not safer mode])
34 AT_DATA([foobar], [contents
35 ])
36 AT_CHECK([test -e foobar])
37 AT_DATA([erase.sps], [dnl
38 erase FILE='foobar'.
39 ])
40 AT_CHECK([pspp -O format=csv erase.sps])
41 AT_CHECK([test ! -e foobar])
42 AT_CLEANUP
43
44 AT_BANNER([N OF CASES])
45
46 AT_SETUP([N OF CASES])
47 AT_DATA([n-of-cases.sps], [dnl
48 INPUT PROGRAM.
49 LOOP #i = 1 TO 100.
50 COMPUTE x=#i.
51 END CASE.
52 END LOOP.
53 END FILE.
54 END INPUT PROGRAM.
55
56 N OF CASES 15.
57
58 LIST.
59 ])
60 AT_CHECK([pspp -O format=csv n-of-cases.sps], [0], [dnl
61 Table: Data List
62 x
63 1.00
64 2.00
65 3.00
66 4.00
67 5.00
68 6.00
69 7.00
70 8.00
71 9.00
72 10.00
73 11.00
74 12.00
75 13.00
76 14.00
77 15.00
78 ])
79 AT_CLEANUP
80
81 AT_BANNER([COMMENT])
82
83 dnl Tests for a bug wherein a comment just before end-of-file caused an
84 dnl infinite loop.
85 AT_SETUP([COMMENT at end of file])
86 AT_DATA([comment.sps], [dnl
87 COMMENT this is a comment at end of file.
88 ])
89 AT_CHECK([pspp -O format=csv comment.sps])
90 AT_CLEANUP