diff src/testdir/test58.in @ 500:4772a5e3f9fa v7.0138

updated for version 7.0138
author vimboss
date Mon, 29 Aug 2005 22:25:38 +0000
parents 21c3634c2113
children ce2181d14aa0
line wrap: on
line diff
--- a/src/testdir/test58.in
+++ b/src/testdir/test58.in
@@ -6,63 +6,50 @@ STARTTEST
 :" Don't want to depend on the locale from the environment
 :set enc=latin1
 :e!
-:" First generate a .spl file from a .dic and a .aff file.
-gg:/^affstart1/+1,/^affend1/-1w! Xtest.aff
-gg:/^dicstart/+1,/^dicend/-1w! Xtest.dic
-:mkspell! Xtest Xtest
 :"
-:" use that spell file
-:set spl=Xtest.latin1.spl
-:set spell
-:func SpellTest()
-/^test1:
-normal ]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 4)
-$put =string(lst)
-normal `m]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 2)
-$put =string(lst)
-normal `m]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 2)
-$put =string(lst)
-normal `m]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 2)
-$put =string(lst)
-normal `m]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 2)
-$put =string(lst)
-normal `m]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 2)
-$put =string(lst)
+:" 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 = 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 SpellTest()
-:spelldump
-1GyG:q
-:$put
+:"
+: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:/^affstart2/+1,/^affend2/-1w! Xtest.aff
+gg:/^affstart_sal/+1,/^affend_sal/-1w! Xtest.aff
 :mkspell! Xtest Xtest
 :$put =soundfold('goobledygoook')
 :$put =soundfold('kóopërÿnôven')
@@ -101,39 +88,16 @@ gg:/^addstart/+1,/^addend/-1w! Xtest.lat
 :$put =str
 :"
 :" Postponed prefixes
-gg:/^affstart3/+1,/^affend3/-1w! Xtest.aff
-:mkspell! Xtest Xtest
-:set spellfile=
-:set spl=Xtest.latin1.spl
-:spelldump
-1GyG:q
-:$put
-:call SpellTest()
+:call TestOne('2', '1')
 :"
-:" Compounding
-gg:/^compaffstart/+1,/^compaffend/-1w! Xtest.aff
-gg:/^compdicstart/+1,/^compdicend/-1w! Xtest.dic
-:mkspell! Xtest Xtest
-:set spellfile=
-:set spl=Xtest.latin1.spl
-:spelldump
-1GyG:q
-:$put
-/^comptest:
-:for i in range(11)
-normal ]smm
-let str = spellbadword()
-$put =str
-normal `m
-let lst = spellsuggest(str, 3)
-$put =string(lst)
-normal `m
-endfor
+:" Compound words
+:call TestOne('3', '3')
+:call TestOne('4', '4')
 :"
 gg:/^test output:/,$wq! test.out
 ENDTEST
 
-affstart1
+1affstart
 SET ISO8859-1
 TRY esianrtolcdugmphbyfvkwjkqxz-ëéèêïîäàâöüû'ESIANRTOLCDUGMPHBYFVKWJKQXZ
 
@@ -182,9 +146,27 @@ MAP nñ
 MAP cç
 MAP yÿý
 MAP sß
-affend1
+1affend
+
+1good: wrong OK puts. Test the end
+bad:  inputs comment ok Ok. test déôl end the
+badend
 
-affstart2
+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
 
@@ -338,9 +320,9 @@ SAL X                    KS
 SAL Y(AEIOU)-            Y
 SAL ZZ-                  _
 SAL Z                    S
-affend2
+affend_sal
 
-affstart3
+2affstart
 SET ISO8859-1
 
 FOL  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
@@ -387,23 +369,47 @@ MAP nñ
 MAP cç
 MAP yÿý
 MAP sß
-affend3
+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
 
-dicstart
-123456
-test/NO
-# comment
-wrong
-Comment
-OK
-uk
-put/ISO
-the end
-deol
-déôr
-dicend
+COMPOUNDMIN 3
+COMPOUNDFLAGS m*
+NEEDCOMPOUND x
+3affend
 
-compaffstart
+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  àáâãäåæçèéêëìíîïðñòóôõöøùúûüýþßÿ
@@ -445,9 +451,9 @@ SFX a 0 ize . nocomp
 
 PFX p N 1
 PFX p 0 pre .
-compaffend
+4affend
 
-compdicstart
+4dicstart
 1234
 word/m
 util/am
@@ -456,37 +462,16 @@ tomato/m
 bork/mp
 start/s
 end/e
-compdicend
-
-addstart
-/regions=usgbnz
-elequint/2
-elekwint/3
-addend
+4dicend
 
-test1:
-inputs	wrong
-comment	wrong
-puts	OK
-ok	wrong
-Ok	wrong
-the end.  test wrong
-déôl
-
-test2:
-elequint test elekwint test elekwent asdf
-
-comptest:
-word util
-wordutil wordutils wordutilize
-pro pro-ok
-bork borkbork borkborkbork borkborkborkbork borkborkborkborkbork
-borkborkborkborkborkbork
-tomato tomatotomato tomatotomatotomato
-startend endstart endend startstart wordend
-startword startwordword wordstart startwordend startwordwordend
-startwordwordwordend startwordwordwordwordend
-prebork preborkprebork preborkborkprebork preborkpreborkbork
-borkpreborkpreborkbork
+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 output: