blob: 0575a44401a2d39438c0a203ffb36a06109f00a4 [file] [log] [blame]
Bram Moolenaar0dc065e2005-07-04 22:49:24 +00001Tests for spell checking. vim: set ft=vim :
2
3STARTTEST
4:so small.vim
5:"
6:" First generate a .spl file from a .dic and a .aff file.
7:set enc=latin1
8:/^affstart1/+1,/affend1/-1w Xtest.aff
9:/^dicstart/+1,/dicend/-1w Xtest.dic
10:mkspell Xtest Xtest
11:"
12:" use that spell file
13:set spl=Xtest.latin1.spl
14:set spell
Bram Moolenaar53180ce2005-07-05 21:48:14 +000015:func SpellTest()
Bram Moolenaar0dc065e2005-07-04 22:49:24 +000016/^test1:
Bram Moolenaar53180ce2005-07-05 21:48:14 +000017normal ]smm
18let str = spellbadword()
19$put =str
20normal `m
21let lst = spellsuggest(str, 4)
22$put =string(lst)
23normal `m]smm
24let str = spellbadword()
25$put =str
26normal `m
27let lst = spellsuggest(str, 2)
28$put =string(lst)
29normal `m]smm
30let str = spellbadword()
31$put =str
32normal `m
33let lst = spellsuggest(str, 2)
34$put =string(lst)
35normal `m]smm
36let str = spellbadword()
37$put =str
38normal `m
39let lst = spellsuggest(str, 2)
40$put =string(lst)
41normal `m]smm
42let str = spellbadword()
43$put =str
44normal `m
45let lst = spellsuggest(str, 2)
46$put =string(lst)
47normal `m]smm
48let str = spellbadword()
49$put =str
50normal `m
51let lst = spellsuggest(str, 2)
52$put =string(lst)
53endfunc
54:call SpellTest()
Bram Moolenaar0dc065e2005-07-04 22:49:24 +000055:spelldump
561GyG:q
57:$put
58:$put =soundfold('goobledygoook')
59:$put =soundfold('kóopërÿnôven')
60:$put =soundfold('oeverloos gezwets edale')
61:"
62:" and now with SAL instead of SOFO items; test automatic reloading
63gg:/^affstart2/+1,/^affend2/-1w! Xtest.aff
64:mkspell! Xtest Xtest
65:$put =soundfold('goobledygoook')
66:$put =soundfold('kóopërÿnôven')
67:$put =soundfold('oeverloos gezwets edale')
68:"
69:" also use an addition file
70gg:/^addstart/+1,/^addend/-1w! Xtest.latin1.add
71:mkspell! Xtest.latin1.add.spl Xtest.latin1.add
72:set spl=en
73:set spellfile=Xtest.latin1.add
74/^test2:
75]s:let str = spellbadword()
76:$put =str
77:set spl=en_us
78/^test2:
79]smm:let str = spellbadword()
80:$put =str
81`m]s:let str = spellbadword()
82:$put =str
83:set spl=en_gb
84/^test2:
85]smm:let str = spellbadword()
86:$put =str
87`m]s:let str = spellbadword()
88:$put =str
89:set spl=en_nz
90/^test2:
91]smm:let str = spellbadword()
92:$put =str
93`m]s:let str = spellbadword()
94:$put =str
95:set spl=en_ca
96/^test2:
97]smm:let str = spellbadword()
98:$put =str
99`m]s:let str = spellbadword()
100:$put =str
101:"
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000102:" Postponed prefixes
103gg:/^affstart3/+1,/^affend3/-1w! Xtest.aff
104:mkspell! Xtest Xtest
105:set spellfile=
106:set spl=Xtest.latin1.spl
107:mess
108:spelldump
1091GyG:q
110:$put
111:call SpellTest()
112:"
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000113gg:/^test output:/,$wq! test.out
114ENDTEST
115
116affstart1
117SET ISO8859-1
118TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
119
120FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
121LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
122UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
123
124SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
125SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
126
127MIDWORD '-
128
129KEP =
130RAR ?
131BAD !
132
133NOSPLITSUGS
134
135PFX I N 1
136PFX I 0 in .
137
138PFX O Y 1
139PFX O 0 out .
140
141SFX S Y 2
142SFX S 0 s [^s]
143SFX S 0 es s
144
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000145SFX N N 3
146SFX N 0 en [^n]
147SFX N 0 nen n
148SFX N 0 n .
149
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000150REP 3
151REP g ch
152REP ch g
153REP svp s.v.p.
154
155MAP 9
156MAP aàáâãäå
157MAP eèéêë
158MAP iìíîï
159MAP oòóôõö
160MAP uùúûü
161MAP nñ
162MAP cç
163MAP yÿý
164MAP sß
165affend1
166
167affstart2
168SET ISO8859-1
169TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
170
171FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
172LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
173UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
174
175MIDWORD '-
176
177KEP =
178RAR ?
179BAD !
180
181NOSPLITSUGS
182
183PFX I N 1
184PFX I 0 in .
185
186PFX O Y 1
187PFX O 0 out .
188
189SFX S Y 2
190SFX S 0 s [^s]
191SFX S 0 es s
192
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000193SFX N N 3
194SFX N 0 en [^n]
195SFX N 0 nen n
196SFX N 0 n .
197
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000198REP 3
199REP g ch
200REP ch g
201REP svp s.v.p.
202
203MAP 9
204MAP aàáâãäå
205MAP eèéêë
206MAP iìíîï
207MAP oòóôõö
208MAP uùúûü
209MAP nñ
210MAP cç
211MAP yÿý
212MAP sß
213
214SAL AH(AEIOUY)-^ *H
215SAL AR(AEIOUY)-^ *R
216SAL A(HR)^ *
217SAL A^ *
218SAL AH(AEIOUY)- H
219SAL AR(AEIOUY)- R
220SAL A(HR) _
221SAL À^ *
222SAL Å^ *
223SAL BB- _
224SAL B B
225SAL CQ- _
226SAL CIA X
227SAL CH X
228SAL C(EIY)- S
229SAL CK K
230SAL COUGH^ KF
231SAL CC< C
232SAL C K
233SAL DG(EIY) K
234SAL DD- _
235SAL D T
236SAL É< E
237SAL EH(AEIOUY)-^ *H
238SAL ER(AEIOUY)-^ *R
239SAL E(HR)^ *
240SAL ENOUGH^$ *NF
241SAL E^ *
242SAL EH(AEIOUY)- H
243SAL ER(AEIOUY)- R
244SAL E(HR) _
245SAL FF- _
246SAL F F
247SAL GN^ N
248SAL GN$ N
249SAL GNS$ NS
250SAL GNED$ N
251SAL GH(AEIOUY)- K
252SAL GH _
253SAL GG9 K
254SAL G K
255SAL H H
256SAL IH(AEIOUY)-^ *H
257SAL IR(AEIOUY)-^ *R
258SAL I(HR)^ *
259SAL I^ *
260SAL ING6 N
261SAL IH(AEIOUY)- H
262SAL IR(AEIOUY)- R
263SAL I(HR) _
264SAL J K
265SAL KN^ N
266SAL KK- _
267SAL K K
268SAL LAUGH^ LF
269SAL LL- _
270SAL L L
271SAL MB$ M
272SAL MM M
273SAL M M
274SAL NN- _
275SAL N N
276SAL OH(AEIOUY)-^ *H
277SAL OR(AEIOUY)-^ *R
278SAL O(HR)^ *
279SAL O^ *
280SAL OH(AEIOUY)- H
281SAL OR(AEIOUY)- R
282SAL O(HR) _
283SAL PH F
284SAL PN^ N
285SAL PP- _
286SAL P P
287SAL Q K
288SAL RH^ R
289SAL ROUGH^ RF
290SAL RR- _
291SAL R R
292SAL SCH(EOU)- SK
293SAL SC(IEY)- S
294SAL SH X
295SAL SI(AO)- X
296SAL SS- _
297SAL S S
298SAL TI(AO)- X
299SAL TH @
300SAL TCH-- _
301SAL TOUGH^ TF
302SAL TT- _
303SAL T T
304SAL UH(AEIOUY)-^ *H
305SAL UR(AEIOUY)-^ *R
306SAL U(HR)^ *
307SAL U^ *
308SAL UH(AEIOUY)- H
309SAL UR(AEIOUY)- R
310SAL U(HR) _
311SAL V^ W
312SAL V F
313SAL WR^ R
314SAL WH^ W
315SAL W(AEIOU)- W
316SAL X^ S
317SAL X KS
318SAL Y(AEIOU)- Y
319SAL ZZ- _
320SAL Z S
321affend2
322
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000323affstart3
324SET ISO8859-1
325
326FOL àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
327LOW àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
328UPP ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ
329
330PFXPOSTPONE
331
332MIDWORD '-
333
334KEP =
335RAR ?
336BAD !
337
338NOSPLITSUGS
339
340PFX I N 1
341PFX I 0 in .
342
343PFX O Y 1
344PFX O 0 out .
345
346SFX S Y 2
347SFX S 0 s [^s]
348SFX S 0 es s
349
350SFX N N 3
351SFX N 0 en [^n]
352SFX N 0 nen n
353SFX N 0 n .
354
355REP 3
356REP g ch
357REP ch g
358REP svp s.v.p.
359
360MAP 9
361MAP aàáâãäå
362MAP eèéêë
363MAP iìíîï
364MAP oòóôõö
365MAP uùúûü
366MAP nñ
367MAP cç
368MAP yÿý
369MAP sß
370affend3
371
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000372dicstart
373123456
Bram Moolenaar53180ce2005-07-05 21:48:14 +0000374test/NO
Bram Moolenaar0dc065e2005-07-04 22:49:24 +0000375# comment
376wrong
377Comment
378OK
379uk
380put/ISO
381the end
382deol
383déôr
384dicend
385
386addstart
387/regions=usgbnz
388elequint/2
389elekwint/3
390addend
391
392test1:
393inputs wrong
394comment wrong
395puts OK
396ok wrong
397Ok wrong
398the end. test wrong
399déôl
400
401test2:
402elequint test elekwint test elekwent asdf
403
404
405test output: