changeset 25352:202bc982008b v8.2.3213

patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested Commit: https://github.com/vim/vim/commit/9c9472ff49b09c3d8f747b330eeb1cdb92bab449 Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Sat Jul 24 20:51:13 2021 +0200 patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not tested Problem: NOCOMPOUNDSUGS entry in spell file not tested. Solution: Add a test. (Dominique Pell?, closes https://github.com/vim/vim/issues/8624)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Jul 2021 21:00:04 +0200
parents b1237e9ced5f
children d583eeabddee
files src/testdir/test_spellfile.vim src/version.c
diffstat 2 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_spellfile.vim
+++ b/src/testdir/test_spellfile.vim
@@ -943,6 +943,52 @@ func Test_spellfile_CHECKCOMPOUNDPATTERN
   call delete('XtestCHECKCOMPOUNDPATTERN-utf8.spl')
 endfunc
 
+" Test NOCOMPOUNDSUGS (see :help spell-NOCOMPOUNDSUGS)
+func Test_spellfile_NOCOMPOUNDSUGS()
+  call writefile(['3',
+        \         'one/c',
+        \         'two/c',
+        \         'three/c'], 'XtestNOCOMPOUNDSUGS.dic')
+
+  " pass 0 tests without NOCOMPOUNDSUGS, pass 1 tests with NOCOMPOUNDSUGS
+  for pass in [0, 1]
+    if pass == 0
+      call writefile(['COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
+    else
+      call writefile(['NOCOMPOUNDSUGS',
+          \           'COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
+    endif
+
+    mkspell! XtestNOCOMPOUNDSUGS-utf8.spl XtestNOCOMPOUNDSUGS
+    set spell spelllang=XtestNOCOMPOUNDSUGS-utf8.spl
+
+    for goodword in ['one', 'two', 'three',
+          \          'oneone', 'onetwo',  'onethree',
+          \          'twoone', 'twotwo', 'twothree',
+          \          'threeone', 'threetwo', 'threethree',
+          \          'onetwothree', 'onethreetwo', 'twothreeone', 'oneoneone']
+      call assert_equal(['', ''], spellbadword(goodword), goodword)
+    endfor
+
+    for badword in ['four', 'onetwox', 'onexone']
+      call assert_equal([badword, 'bad'], spellbadword(badword))
+    endfor
+
+    if pass == 0
+      call assert_equal(['one', 'oneone'], spellsuggest('onne', 2))
+      call assert_equal(['onethree', 'one three'], spellsuggest('onethre', 2))
+    else
+      call assert_equal(['one', 'one one'], spellsuggest('onne', 2))
+      call assert_equal(['one three'], spellsuggest('onethre', 2))
+    endif
+  endfor
+
+  set spell& spelllang&
+  call delete('XtestNOCOMPOUNDSUGS.dic')
+  call delete('XtestNOCOMPOUNDSUGS.aff')
+  call delete('XtestNOCOMPOUNDSUGS-utf8.spl')
+endfunc
+
 " Test COMMON (better suggestions with common words, see :help spell-COMMON)
 func Test_spellfile_COMMON()
   call writefile(['7',
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3213,
+/**/
     3212,
 /**/
     3211,