diff options
author | Dominique Pelle <dominique.pelle@gmail.com> | 2021-07-24 20:51:13 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-07-24 20:51:13 +0200 |
commit | 9c9472ff49b09c3d8f747b330eeb1cdb92bab449 (patch) | |
tree | 46f46fb44d656f8b5a512dc5bc1f25224725f5ca /src | |
parent | 5a9e5845e1539592e94963fcdf5b3ad4fdc59db4 (diff) | |
download | vim-git-9c9472ff49b09c3d8f747b330eeb1cdb92bab449.tar.gz |
patch 8.2.3213: NOCOMPOUNDSUGS entry in spell file not testedv8.2.3213
Problem: NOCOMPOUNDSUGS entry in spell file not tested.
Solution: Add a test. (Dominique Pellé, closes #8624)
Diffstat (limited to 'src')
-rw-r--r-- | src/testdir/test_spellfile.vim | 46 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 48 insertions, 0 deletions
diff --git a/src/testdir/test_spellfile.vim b/src/testdir/test_spellfile.vim index b7bb50198..c0852e090 100644 --- 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', diff --git a/src/version.c b/src/version.c index 2b992dbfd..d73bddb4f 100644 --- 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, |