1
0
forked from aniani/vim

patch 8.2.3345: some code not covered by tests

Problem:    Some code not covered by tests.
Solution:   Add a few more tests. (Dominique Pellé, closes #8757)
This commit is contained in:
Dominique Pelle
2021-08-14 21:11:51 +02:00
committed by Bram Moolenaar
parent d2e9ccee90
commit bfb2bb16bc
5 changed files with 84 additions and 0 deletions

View File

@@ -1016,6 +1016,33 @@ func Test_spellfile_COMMON()
call delete('XtestCOMMON-utf8.spl')
endfunc
" Test NOSUGGEST (see :help spell-COMMON)
func Test_spellfile_NOSUGGEST()
call writefile(['2', 'foo/X', 'fog'], 'XtestNOSUGGEST.dic')
call writefile(['NOSUGGEST X'], 'XtestNOSUGGEST.aff')
mkspell! XtestNOSUGGEST-utf8.spl XtestNOSUGGEST
set spell spelllang=XtestNOSUGGEST-utf8.spl
for goodword in ['foo', 'Foo', 'FOO', 'fog', 'Fog', 'FOG']
call assert_equal(['', ''], spellbadword(goodword), goodword)
endfor
for badword in ['foO', 'fOO', 'fooo', 'foog', 'foofog', 'fogfoo']
call assert_equal([badword, 'bad'], spellbadword(badword))
endfor
call assert_equal(['fog'], spellsuggest('fooo', 1))
call assert_equal(['fog'], spellsuggest('fOo', 1))
call assert_equal(['fog'], spellsuggest('foG', 1))
call assert_equal(['fog'], spellsuggest('fogg', 1))
set spell& spelllang&
call delete('XtestNOSUGGEST.dic')
call delete('XtestNOSUGGEST.aff')
call delete('XtestNOSUGGEST-utf8.spl')
endfunc
" Test CIRCUMFIX (see: :help spell-CIRCUMFIX)
func Test_spellfile_CIRCUMFIX()
" Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests