comparison src/testdir/test_spellfile.vim @ 25617:28f1b7c38ba1 v8.2.3345

patch 8.2.3345: some code not covered by tests Commit: https://github.com/vim/vim/commit/bfb2bb16bc69441fa3ec13caacb2c94637a8a0ec Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Sat Aug 14 21:11:51 2021 +0200 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 https://github.com/vim/vim/issues/8757)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Aug 2021 21:15:02 +0200
parents 202bc982008b
children 485c7c4afeb7
comparison
equal deleted inserted replaced
25616:1c4fe811755c 25617:28f1b7c38ba1
1014 call delete('XtestCOMMON.dic') 1014 call delete('XtestCOMMON.dic')
1015 call delete('XtestCOMMON.aff') 1015 call delete('XtestCOMMON.aff')
1016 call delete('XtestCOMMON-utf8.spl') 1016 call delete('XtestCOMMON-utf8.spl')
1017 endfunc 1017 endfunc
1018 1018
1019 " Test NOSUGGEST (see :help spell-COMMON)
1020 func Test_spellfile_NOSUGGEST()
1021 call writefile(['2', 'foo/X', 'fog'], 'XtestNOSUGGEST.dic')
1022 call writefile(['NOSUGGEST X'], 'XtestNOSUGGEST.aff')
1023
1024 mkspell! XtestNOSUGGEST-utf8.spl XtestNOSUGGEST
1025 set spell spelllang=XtestNOSUGGEST-utf8.spl
1026
1027 for goodword in ['foo', 'Foo', 'FOO', 'fog', 'Fog', 'FOG']
1028 call assert_equal(['', ''], spellbadword(goodword), goodword)
1029 endfor
1030 for badword in ['foO', 'fOO', 'fooo', 'foog', 'foofog', 'fogfoo']
1031 call assert_equal([badword, 'bad'], spellbadword(badword))
1032 endfor
1033
1034 call assert_equal(['fog'], spellsuggest('fooo', 1))
1035 call assert_equal(['fog'], spellsuggest('fOo', 1))
1036 call assert_equal(['fog'], spellsuggest('foG', 1))
1037 call assert_equal(['fog'], spellsuggest('fogg', 1))
1038
1039 set spell& spelllang&
1040 call delete('XtestNOSUGGEST.dic')
1041 call delete('XtestNOSUGGEST.aff')
1042 call delete('XtestNOSUGGEST-utf8.spl')
1043 endfunc
1044
1045
1019 " Test CIRCUMFIX (see: :help spell-CIRCUMFIX) 1046 " Test CIRCUMFIX (see: :help spell-CIRCUMFIX)
1020 func Test_spellfile_CIRCUMFIX() 1047 func Test_spellfile_CIRCUMFIX()
1021 " Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests 1048 " Example taken verbatim from https://github.com/hunspell/hunspell/tree/master/tests
1022 call writefile(['1', 1049 call writefile(['1',
1023 \ 'nagy/C po:adj'], 'XtestCIRCUMFIX.dic') 1050 \ 'nagy/C po:adj'], 'XtestCIRCUMFIX.dic')