@@ -943,6 +943,52 @@ func Test_spellfile_CHECKCOMPOUNDPATTERN()
943943 call delete (' XtestCHECKCOMPOUNDPATTERN-utf8.spl' )
944944endfunc
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)
947993func Test_spellfile_COMMON ()
948994 call writefile ([' 7' ,
0 commit comments