febf81f6e6df5d75df6c30c1fb4d64a548832d27
[pspp] / tests / language / dictionary / string.at
1 AT_BANNER([STRING])
2
3 AT_SETUP([STRING])
4 AT_DATA([string.sps], [dnl
5 DATA LIST LIST NOTABLE/x y z.
6 STRING s1 (A8)/s2 (A1).
7 DISPLAY DICTIONARY.
8 ])
9 AT_CHECK([pspp -O format=csv string.sps], [0], [dnl
10 Table: Variables
11 Name,Position,Measurement Level,Role,Width,Alignment,Print Format,Write Format
12 x,1,Unknown,Input,8,Right,F8.2,F8.2
13 y,2,Unknown,Input,8,Right,F8.2,F8.2
14 z,3,Unknown,Input,8,Right,F8.2,F8.2
15 s1,4,Nominal,Input,8,Left,A8,A8
16 s2,5,Nominal,Input,1,Left,A1,A1
17 ])
18 AT_CLEANUP
19
20 AT_SETUP([STRING syntax errors])
21 AT_DATA([string.sps], [dnl
22 DATA LIST LIST NOTABLE/x y z.
23 STRING **.
24 STRING s **.
25 STRING s (**).
26 STRING s (F8).
27 STRING s (AHEX1).
28 STRING s (A8 **).
29 STRING x (A8).
30 ])
31 AT_CHECK([pspp -O format=csv string.sps], [1], [dnl
32 "string.sps:2.8-2.9: error: STRING: Syntax error expecting variable name.
33     2 | STRING **.
34       |        ^~"
35
36 "string.sps:3.10-3.11: error: STRING: Syntax error expecting `('.
37     3 | STRING s **.
38       |          ^~"
39
40 "string.sps:4.11-4.12: error: STRING: Syntax error expecting valid format specifier.
41     4 | STRING s (**).
42       |           ^~"
43
44 "string.sps:5.11-5.12: error: STRING: String variables are not compatible with numeric format F8.0.
45     5 | STRING s (F8).
46       |           ^~"
47
48 "string.sps:6.11-6.15: error: STRING: Output format AHEX1 specifies width 1, but AHEX requires an even width.
49     6 | STRING s (AHEX1).
50       |           ^~~~~"
51
52 "string.sps:7.14-7.15: error: STRING: Syntax error expecting `)'.
53     7 | STRING s (A8 **).
54       |              ^~"
55
56 "string.sps:8.8: error: STRING: There is already a variable named x.
57     8 | STRING x (A8).
58       |        ^"
59 ])
60 AT_CLEANUP