aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-08-01 09:39:05 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-08-01 11:26:54 -0400
commitd95e28f5ce9c8a156423bf29900f159ce313de35 (patch)
tree2b7cd07536bcdef6f87ce1198de229b3f13a3339
parent34f3c5cc9604e6ef241bd690b94e2f2593d03b55 (diff)
downloadrneovim-d95e28f5ce9c8a156423bf29900f159ce313de35.tar.gz
rneovim-d95e28f5ce9c8a156423bf29900f159ce313de35.tar.bz2
rneovim-d95e28f5ce9c8a156423bf29900f159ce313de35.zip
vim-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 vim/vim#8624) https://github.com/vim/vim/commit/9c9472ff49b09c3d8f747b330eeb1cdb92bab449
-rw-r--r--src/nvim/testdir/test_spellfile.vim46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_spellfile.vim b/src/nvim/testdir/test_spellfile.vim
index 729467b556..0f48ab8f6f 100644
--- a/src/nvim/testdir/test_spellfile.vim
+++ b/src/nvim/testdir/test_spellfile.vim
@@ -210,6 +210,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',