diff 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
line wrap: on
line diff
--- a/src/testdir/test_spellfile.vim
+++ b/src/testdir/test_spellfile.vim
@@ -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