Enable the show value labels feature
[pspp] / tests / language / lexer / command-name.at
1 AT_BANNER([command name matching])
2 \f
3 AT_SETUP([single words])
4 AT_KEYWORDS([command name matching])
5 AT_CHECK([command-name-test DESCRIPTIVES , DESCRIPTIVESX DESCRIPTIVES descr Des DEX DE '' 'DESCRIPTIVES MORE' 'DESCRIPTIVES@<00A0>@MORE'],
6   [0], [dnl
7 string="DESCRIPTIVESX":
8         command="DESCRIPTIVES" match=no
9 match: none, missing_words=0
10
11 string="DESCRIPTIVES":
12         command="DESCRIPTIVES" match=yes exact=yes missing_words=0
13 match: DESCRIPTIVES, missing_words=0
14
15 string="descr":
16         command="DESCRIPTIVES" match=yes exact=no missing_words=0
17 match: DESCRIPTIVES, missing_words=0
18
19 string="Des":
20         command="DESCRIPTIVES" match=yes exact=no missing_words=0
21 match: DESCRIPTIVES, missing_words=0
22
23 string="DEX":
24         command="DESCRIPTIVES" match=no
25 match: none, missing_words=0
26
27 string="DE":
28         command="DESCRIPTIVES" match=no
29 match: none, missing_words=0
30
31 string="":
32         command="DESCRIPTIVES" match=yes exact=yes missing_words=1
33 match: none, missing_words=1
34
35 string="DESCRIPTIVES MORE":
36         command="DESCRIPTIVES" match=yes exact=yes missing_words=-1
37 match: DESCRIPTIVES, missing_words=-1
38
39 string="DESCRIPTIVES@<00A0>@MORE":
40         command="DESCRIPTIVES" match=yes exact=yes missing_words=-1
41 match: DESCRIPTIVES, missing_words=-1
42 ])
43 AT_CLEANUP
44 \f
45 AT_SETUP([two words without prefix match])
46 AT_KEYWORDS([command name matching])
47 AT_CHECK([command-name-test 'DO IF' 'DO REPEAT' , 'DO@<00A0>@IF' 'DO REPEAT' 'DO REP' 'DO OTHER' 'D IF' 'DO I' DO],
48   [0], [dnl
49 string="DO@<00A0>@IF":
50         command="DO IF" match=yes exact=yes missing_words=0
51         command="DO REPEAT" match=no
52 match: DO IF, missing_words=0
53
54 string="DO REPEAT":
55         command="DO IF" match=no
56         command="DO REPEAT" match=yes exact=yes missing_words=0
57 match: DO REPEAT, missing_words=0
58
59 string="DO REP":
60         command="DO IF" match=no
61         command="DO REPEAT" match=yes exact=no missing_words=0
62 match: DO REPEAT, missing_words=0
63
64 string="DO OTHER":
65         command="DO IF" match=no
66         command="DO REPEAT" match=no
67 match: none, missing_words=0
68
69 string="D IF":
70         command="DO IF" match=no
71         command="DO REPEAT" match=no
72 match: none, missing_words=0
73
74 string="DO I":
75         command="DO IF" match=no
76         command="DO REPEAT" match=no
77 match: none, missing_words=0
78
79 string="DO":
80         command="DO IF" match=yes exact=yes missing_words=1
81         command="DO REPEAT" match=yes exact=yes missing_words=1
82 match: none, missing_words=1
83 ])
84 AT_CLEANUP
85 \f
86 AT_SETUP([two words with prefix match])
87 AT_KEYWORDS([command name matching])
88 AT_CHECK([command-name-test GET 'GET DATA' , GET 'GET TYPE' 'GET DAT' 'GET DATA'],
89   [0], [dnl
90 string="GET":
91         command="GET" match=yes exact=yes missing_words=0
92         command="GET DATA" match=yes exact=yes missing_words=1
93 match: none, missing_words=1
94
95 string="GET TYPE":
96         command="GET" match=yes exact=yes missing_words=-1
97         command="GET DATA" match=no
98 match: GET, missing_words=-1
99
100 string="GET DAT":
101         command="GET" match=yes exact=yes missing_words=-1
102         command="GET DATA" match=yes exact=no missing_words=0
103 match: GET DATA, missing_words=0
104
105 string="GET DATA":
106         command="GET" match=yes exact=yes missing_words=-1
107         command="GET DATA" match=yes exact=yes missing_words=0
108 match: GET DATA, missing_words=0
109 ])
110 AT_CLEANUP
111 \f
112 AT_SETUP([ambiguous single-word names])
113 AT_KEYWORDS([command name matching])
114 AT_CHECK([command-name-test CASEPLOT CASESTOVARS , CAS Case CaseP CaseS], [0],
115   [dnl
116 string="CAS":
117         command="CASEPLOT" match=yes exact=no missing_words=0
118         command="CASESTOVARS" match=yes exact=no missing_words=0
119 match: none, missing_words=0
120
121 string="Case":
122         command="CASEPLOT" match=yes exact=no missing_words=0
123         command="CASESTOVARS" match=yes exact=no missing_words=0
124 match: none, missing_words=0
125
126 string="CaseP":
127         command="CASEPLOT" match=yes exact=no missing_words=0
128         command="CASESTOVARS" match=no
129 match: CASEPLOT, missing_words=0
130
131 string="CaseS":
132         command="CASEPLOT" match=no
133         command="CASESTOVARS" match=yes exact=no missing_words=0
134 match: CASESTOVARS, missing_words=0
135 ])
136 AT_CLEANUP
137
138 AT_SETUP([ambiguous two-word names])
139 AT_KEYWORDS([command name matching])
140 AT_CHECK([command-name-test VARCOMP VARSTOCASES 'VARIABLE ATTRIBUTE' , VAR VARC VARS VARI 'VAR@<00A0>@ATT'],
141   [0], [dnl
142 string="VAR":
143         command="VARCOMP" match=yes exact=no missing_words=0
144         command="VARSTOCASES" match=yes exact=no missing_words=0
145         command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=1
146 match: none, missing_words=1
147
148 string="VARC":
149         command="VARCOMP" match=yes exact=no missing_words=0
150         command="VARSTOCASES" match=no
151         command="VARIABLE ATTRIBUTE" match=no
152 match: VARCOMP, missing_words=0
153
154 string="VARS":
155         command="VARCOMP" match=no
156         command="VARSTOCASES" match=yes exact=no missing_words=0
157         command="VARIABLE ATTRIBUTE" match=no
158 match: VARSTOCASES, missing_words=0
159
160 string="VARI":
161         command="VARCOMP" match=no
162         command="VARSTOCASES" match=no
163         command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=1
164 match: none, missing_words=1
165
166 string="VAR@<00A0>@ATT":
167         command="VARCOMP" match=yes exact=no missing_words=-1
168         command="VARSTOCASES" match=yes exact=no missing_words=-1
169         command="VARIABLE ATTRIBUTE" match=yes exact=no missing_words=0
170 match: VARIABLE ATTRIBUTE, missing_words=0
171 ])
172 AT_CLEANUP
173 \f
174 AT_SETUP([numbers and punctuation])
175 AT_KEYWORDS([command name matching])
176 AT_CHECK([command-name-test T-TEST 2SLS LIST , T-TEST 'T - Test' 2SLS '2 SLS' List],
177   [0], [dnl
178 string="T-TEST":
179         command="T-TEST" match=yes exact=yes missing_words=0
180         command="2SLS" match=no
181         command="LIST" match=no
182 match: T-TEST, missing_words=0
183
184 string="T - Test":
185         command="T-TEST" match=yes exact=yes missing_words=0
186         command="2SLS" match=no
187         command="LIST" match=no
188 match: T-TEST, missing_words=0
189
190 string="2SLS":
191         command="T-TEST" match=no
192         command="2SLS" match=yes exact=yes missing_words=0
193         command="LIST" match=no
194 match: 2SLS, missing_words=0
195
196 string="2 SLS":
197         command="T-TEST" match=no
198         command="2SLS" match=yes exact=yes missing_words=0
199         command="LIST" match=no
200 match: 2SLS, missing_words=0
201
202 string="List":
203         command="T-TEST" match=no
204         command="2SLS" match=no
205         command="LIST" match=yes exact=yes missing_words=0
206 match: LIST, missing_words=0
207 ])
208 AT_CLEANUP
209 \f
210 AT_SETUP([off by more than one word])
211 AT_KEYWORDS([command name matching])
212 AT_CHECK([command-name-test 'a@<00A0>@b c' , a 'a b' 'a b c' 'a@<00A0>@b c d' 'a b c@<00A0>@d e'],
213   [0], [dnl
214 string="a":
215         command="a@<00A0>@b c" match=yes exact=yes missing_words=2
216 match: none, missing_words=1
217
218 string="a b":
219         command="a@<00A0>@b c" match=yes exact=yes missing_words=1
220 match: none, missing_words=1
221
222 string="a b c":
223         command="a@<00A0>@b c" match=yes exact=yes missing_words=0
224 match: a@<00A0>@b c, missing_words=0
225
226 string="a@<00A0>@b c d":
227         command="a@<00A0>@b c" match=yes exact=yes missing_words=-1
228 match: a@<00A0>@b c, missing_words=-1
229
230 string="a b c@<00A0>@d e":
231         command="a@<00A0>@b c" match=yes exact=yes missing_words=-2
232 match: a@<00A0>@b c, missing_words=-2
233 ])
234 AT_CLEANUP