Skip to content

Commit 9c9472f

Browse files
dpellebrammool
authored andcommitted
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 #8624)
1 parent 5a9e584 commit 9c9472f

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

src/testdir/test_spellfile.vim

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -943,6 +943,52 @@ func Test_spellfile_CHECKCOMPOUNDPATTERN()
943943
call delete('XtestCHECKCOMPOUNDPATTERN-utf8.spl')
944944
endfunc
945945

946+
" Test NOCOMPOUNDSUGS (see :help spell-NOCOMPOUNDSUGS)
947+
func Test_spellfile_NOCOMPOUNDSUGS()
948+
call writefile(['3',
949+
\ 'one/c',
950+
\ 'two/c',
951+
\ 'three/c'], 'XtestNOCOMPOUNDSUGS.dic')
952+
953+
" pass 0 tests without NOCOMPOUNDSUGS, pass 1 tests with NOCOMPOUNDSUGS
954+
for pass in [0, 1]
955+
if pass == 0
956+
call writefile(['COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
957+
else
958+
call writefile(['NOCOMPOUNDSUGS',
959+
\ 'COMPOUNDFLAG c'], 'XtestNOCOMPOUNDSUGS.aff')
960+
endif
961+
962+
mkspell! XtestNOCOMPOUNDSUGS-utf8.spl XtestNOCOMPOUNDSUGS
963+
set spell spelllang=XtestNOCOMPOUNDSUGS-utf8.spl
964+
965+
for goodword in ['one', 'two', 'three',
966+
\ 'oneone', 'onetwo', 'onethree',
967+
\ 'twoone', 'twotwo', 'twothree',
968+
\ 'threeone', 'threetwo', 'threethree',
969+
\ 'onetwothree', 'onethreetwo', 'twothreeone', 'oneoneone']
970+
call assert_equal(['', ''], spellbadword(goodword), goodword)
971+
endfor
972+
973+
for badword in ['four', 'onetwox', 'onexone']
974+
call assert_equal([badword, 'bad'], spellbadword(badword))
975+
endfor
976+
977+
if pass == 0
978+
call assert_equal(['one', 'oneone'], spellsuggest('onne', 2))
979+
call assert_equal(['onethree', 'one three'], spellsuggest('onethre', 2))
980+
else
981+
call assert_equal(['one', 'one one'], spellsuggest('onne', 2))
982+
call assert_equal(['one three'], spellsuggest('onethre', 2))
983+
endif
984+
endfor
985+
986+
set spell& spelllang&
987+
call delete('XtestNOCOMPOUNDSUGS.dic')
988+
call delete('XtestNOCOMPOUNDSUGS.aff')
989+
call delete('XtestNOCOMPOUNDSUGS-utf8.spl')
990+
endfunc
991+
946992
" Test COMMON (better suggestions with common words, see :help spell-COMMON)
947993
func Test_spellfile_COMMON()
948994
call writefile(['7',

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3213,
758760
/**/
759761
3212,
760762
/**/

0 commit comments

Comments
 (0)