view src/testdir/test58.in @ 560:8b84fe17e147 v7.0159

updated for version 7.0159
author vimboss
date Fri, 25 Nov 2005 19:58:47 +0000
parents c8b6b7e1005d
children c78d973dce9e
line wrap: on
line source

Tests for spell checking.     vim: set ft=vim :

STARTTEST
:so small.vim
:"
:" Don't want to depend on the locale from the environment
:set enc=latin1
:e!
:"
:" Function to test .aff/.dic with list of good and bad words.
:func TestOne(aff, dic)
  set spellfile=
  $put =''
  $put ='test '. a:aff . '-' . a:dic
  " Generate a .spl file from a .dic and .aff file.
  exe '1;/^' . a:aff . 'affstart/+1,/^' . a:aff . 'affend/-1w! Xtest.aff'
  exe '1;/^' . a:dic . 'dicstart/+1,/^' . a:dic . 'dicend/-1w! Xtest.dic'
  mkspell! Xtest Xtest
  " use that spell file
  set spl=Xtest.latin1.spl spell
  " list all valid words
  spelldump
  %yank
  quit
  $put
  $put ='-------'
  " find all bad words and suggestions for them
  exe '1;/^' . a:aff . 'good:'
  normal 0f:]s
  let prevbad = ''
  while 1
    let [bad, a] = spellbadword()
    if bad == '' || bad == prevbad || bad == 'badend'
      break
    endif
    let prevbad = bad
    let lst = spellsuggest(bad, 3)
    normal mm
    $put =bad
    $put =string(lst)
    normal `m]s
  endwhile
endfunc
:"
:call TestOne('1', '1')
:$put =soundfold('goobledygoook')
:$put =soundfold('kóopërÿnôven')
:$put =soundfold('oeverloos gezwets edale')
:"
:"
:" and now with SAL instead of SOFO items; test automatic reloading
gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff
:mkspell! Xtest Xtest
:$put =soundfold('goobledygoook')
:$put =soundfold('kóopërÿnôven')
:$put =soundfold('oeverloos gezwets edale')
:"
:" also use an addition file
gg:/^addstart/+1,/^addend/-1w! Xtest.latin1.add
:mkspell! Xtest.latin1.add.spl Xtest.latin1.add
:set spellfile=Xtest.latin1.add
/^test2:
]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_us.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_gb.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_nz.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:set spl=Xtest_ca.latin1.spl
/^test2:
]smm:let [str, a] = spellbadword()
:$put =str
`m]s:let [str, a] = spellbadword()
:$put =str
:"
:" Postponed prefixes
:call TestOne('2', '1')
:"
:" Compound words
:call TestOne('3', '3')
:call TestOne('4', '4')
:call TestOne('5', '5')
:call TestOne('6', '6')
:call TestOne('7', '7')
:"
gg:/^test output:/,$wq! test.out
ENDTEST

1affstart
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ

FOL  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP  ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ

SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞ¿
SOFOTO   ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?

MIDWORD	'-

KEP =
RAR ?
BAD !

NOSPLITSUGS

PFX I N 1
PFX I 0 in .

PFX O Y 1
PFX O 0 out .

SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s

SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .

REP 3
REP g ch
REP ch g
REP svp s.v.p.

MAP 9
MAP aàáâãäå
MAP eèéêë
MAP iìíîï
MAP oòóôõö
MAP uùúûü
MAP nñ
MAP cç
MAP yÿý
MAP sß
1affend

1good: wrong OK puts. Test the end
bad:  inputs comment ok Ok. test déôl end the
badend

1dicstart
123456
test/NO
# comment
wrong
Comment
OK
uk
put/ISO
the end
deol
déôr
1dicend

affstart_sal
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ

FOL  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP  ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ

MIDWORD	'-

KEP =
RAR ?
BAD !

NOSPLITSUGS

PFX I N 1
PFX I 0 in .

PFX O Y 1
PFX O 0 out .

SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s

SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .

REP 3
REP g ch
REP ch g
REP svp s.v.p.

MAP 9
MAP aàáâãäå
MAP eèéêë
MAP iìíîï
MAP oòóôõö
MAP uùúûü
MAP nñ
MAP cç
MAP yÿý
MAP sß

SAL AH(AEIOUY)-^         *H
SAL AR(AEIOUY)-^         *R
SAL A(HR)^               *
SAL A^                   *
SAL AH(AEIOUY)-          H
SAL AR(AEIOUY)-          R
SAL A(HR)                _
SAL À^                   *
SAL Å^                   *
SAL BB-                  _
SAL B                    B
SAL CQ-                  _
SAL CIA                  X
SAL CH                   X
SAL C(EIY)-              S
SAL CK                   K
SAL COUGH^               KF
SAL CC<                  C
SAL C                    K
SAL DG(EIY)              K
SAL DD-                  _
SAL D                    T
SAL É<                   E
SAL EH(AEIOUY)-^         *H
SAL ER(AEIOUY)-^         *R
SAL E(HR)^               *
SAL ENOUGH^$             *NF
SAL E^                   *
SAL EH(AEIOUY)-          H
SAL ER(AEIOUY)-          R
SAL E(HR)                _
SAL FF-                  _
SAL F                    F
SAL GN^                  N
SAL GN$                  N
SAL GNS$                 NS
SAL GNED$                N
SAL GH(AEIOUY)-          K
SAL GH                   _
SAL GG9                  K
SAL G                    K
SAL H                    H
SAL IH(AEIOUY)-^         *H
SAL IR(AEIOUY)-^         *R
SAL I(HR)^               *
SAL I^                   *
SAL ING6                 N
SAL IH(AEIOUY)-          H
SAL IR(AEIOUY)-          R
SAL I(HR)                _
SAL J                    K
SAL KN^                  N
SAL KK-                  _
SAL K                    K
SAL LAUGH^               LF
SAL LL-                  _
SAL L                    L
SAL MB$                  M
SAL MM                   M
SAL M                    M
SAL NN-                  _
SAL N                    N
SAL OH(AEIOUY)-^         *H
SAL OR(AEIOUY)-^         *R
SAL O(HR)^               *
SAL O^                   *
SAL OH(AEIOUY)-          H
SAL OR(AEIOUY)-          R
SAL O(HR)                _
SAL PH                   F
SAL PN^                  N
SAL PP-                  _
SAL P                    P
SAL Q                    K
SAL RH^                  R
SAL ROUGH^               RF
SAL RR-                  _
SAL R                    R
SAL SCH(EOU)-            SK
SAL SC(IEY)-             S
SAL SH                   X
SAL SI(AO)-              X
SAL SS-                  _
SAL S                    S
SAL TI(AO)-              X
SAL TH                   @
SAL TCH--                _
SAL TOUGH^               TF
SAL TT-                  _
SAL T                    T
SAL UH(AEIOUY)-^         *H
SAL UR(AEIOUY)-^         *R
SAL U(HR)^               *
SAL U^                   *
SAL UH(AEIOUY)-          H
SAL UR(AEIOUY)-          R
SAL U(HR)                _
SAL V^                   W
SAL V                    F
SAL WR^                  R
SAL WH^                  W
SAL W(AEIOU)-            W
SAL X^                   S
SAL X                    KS
SAL Y(AEIOU)-            Y
SAL ZZ-                  _
SAL Z                    S
affend_sal

2affstart
SET ISO8859-1

FOL  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP  ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ

PFXPOSTPONE

MIDWORD	'-

KEP =
RAR ?
BAD !

NOSPLITSUGS

PFX I N 1
PFX I 0 in .

PFX O Y 1
PFX O 0 out [a-z]

SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s

SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .

REP 3
REP g ch
REP ch g
REP svp s.v.p.

MAP 9
MAP aàáâãäå
MAP eèéêë
MAP iìíîï
MAP oòóôõö
MAP uùúûü
MAP nñ
MAP cç
MAP yÿý
MAP sß
2affend

2good: puts
bad: inputs comment ok Ok end the. test déôl
badend

addstart
/regions=usgbnz
elequint/2
elekwint/3
addend

test2:
elequint test elekwint test elekwent asdf

Test rules for compounding.

3affstart
SET ISO8859-1

COMPOUNDMIN 3
COMPOUNDFLAGS m*
NEEDCOMPOUND x
3affend

3dicstart
1234
foo/m
bar/mx
mï/m
la/mx
3dicend

3good: foo mï foobar foofoobar barfoo barbarfoo
bad: bar la foomï barmï mïfoo mïbar mïmï lala mïla lamï foola labar
badend


Tests for compounding.

4affstart
SET ISO8859-1

FOL  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
LOW  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
UPP  ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßÿ

COMPOUNDFLAGS m+
COMPOUNDFLAGS sm*e
COMPOUNDFLAGS sm+
COMPOUNDMIN 3
COMPOUNDMAX 3

COMPOUNDSYLMAX 5
SYLLABLE aáeéiíoóöõuúüûy/aa/au/ea/ee/ei/ie/oa/oe/oo/ou/uu/ui

MAP 9
MAP aàáâãäå
MAP eèéêë
MAP iìíîï
MAP oòóôõö
MAP uùúûü
MAP nñ
MAP cç
MAP yÿý
MAP sß

NEEDAFFIX x

PFXPOSTPONE

MIDWORD '-

SFX q N 1
SFX q   0    -ok .

SFX a Y 2
SFX a 0 s .
SFX a 0 ize . nocomp

PFX p N 1
PFX p 0 pre .
4affend

4dicstart
1234
word/m
util/am
pro/xq
tomato/m
bork/mp
start/s
end/e
4dicend

4good: word util bork prebork start end wordutil wordutils pro-ok
	bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
	tomato tomatotomato startend startword startwordword startwordend
	startwordwordend startwordwordwordend prebork preborkprebork
	preborkborkprebork preborkpreborkbork
bad: wordutilize pro borkborkborkborkborkbork tomatotomatotomato
	endstart endend startstart wordend wordstart
 	startwordwordwordwordend borkpreborkpreborkbork
badend

Test affix flags with two characters

5affstart
SET ISO8859-1

FLAG long

NEEDAFFIX !!

COMPOUNDFLAGS ssmm*ee

NEEDCOMPOUND xx

SFX 13 Y 1
SFX 13 0 bork .

SFX a1 Y 1
SFX a1 0 a1 .

SFX aé Y 1
SFX aé 0 aé .

PFX zz Y 1
PFX zz 0 pre .
5affend

5dicstart
1234
foo/a1aé!!
bar/zz13ee
start/ss
end/ee
middle/mmxx
5dicend

5good: fooa1 fooaé bar prebar barbork prebarbork  startprebar
      start end startend  startmiddleend
bad: foo fooa2 prabar probarbirk middle startmiddle middleend endstart
	startprobar
badend

6affstart
SET ISO8859-1

FLAG caplong

NEEDAFFIX A!

COMPOUNDFLAGS sMm*Ee

NEEDCOMPOUND Xx

SFX N3 Y 1
SFX N3 0 bork .

SFX A1 Y 1
SFX A1 0 a1 .

SFX Aé Y 1
SFX Aé 0 aé .

PFX Zz Y 1
PFX Zz 0 pre .
6affend

6dicstart
1234
mee/A1AéA!
bar/ZzN3Ee
lead/s
end/Ee
middle/MmXx
6dicend

6good: meea1 meeaé bar prebar barbork prebarbork  leadprebar
      lead end leadend  leadmiddleend
bad: mee meea2 prabar probarbirk middle leadmiddle middleend endlead
	leadprobar
badend

7affstart
SET ISO8859-1

FLAG num

NEEDAFFIX 9999

COMPOUNDFLAGS 2,77*123

NEEDCOMPOUND 1

SFX 61003 Y 1
SFX 61003 0 meat .

SFX 391 Y 1
SFX 391 0 a1 .

SFX 111 Y 1
SFX 111 0 aé .

PFX 17 Y 1
PFX 17 0 pre .
7affend

7dicstart
1234
mee/391,111,9999
bar/17,61003,123
lead/2
tail/123
middle/77,1
7dicend

7good: meea1 meeaé bar prebar barmeat prebarmeat  leadprebar
      lead tail leadtail  leadmiddletail
bad: mee meea2 prabar probarmaat middle leadmiddle middletail taillead
	leadprobar
badend

test output: