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