Patch 8.2.1651
Problem: Spellfile code not completely tested.
Solution: Add a few more test cases. (Yegappan Lakshmanan, closes #6918)
Files: src/testdir/test_spellfile.vim
*** ../vim-8.2.1650/src/testdir/test_spellfile.vim 2020-08-25
21:19:31.434276759 +0200
--- src/testdir/test_spellfile.vim 2020-09-09 22:41:44.682968914 +0200
***************
*** 179,184 ****
--- 179,189 ----
" Add the spell file header and version (VIMspell2)
let v = 0z56494D7370656C6C32 + a:content
call writefile(v, splfile, 'b')
+
+ " 'encoding' is set before each test to clear the previously loaded suggest
+ " file from memory.
+ set encoding=utf-8
+
set runtimepath=./Xtest
set spelllang=Xtest
if a:emsg != ''
***************
*** 299,304 ****
--- 304,312 ----
" SN_SOFO: missing sofoto
call Spellfile_Test(0z0600000000050001610000, 'E759:')
+ " SN_SOFO: empty sofofrom and sofoto
+ call Spellfile_Test(0z06000000000400000000FF000000000000000000000000, '')
+
" SN_COMPOUND: compmax is less than 2
call Spellfile_Test(0z08000000000101, 'E759:')
***************
*** 308,313 ****
--- 316,327 ----
" SN_COMPOUND: missing compoptions
call Spellfile_Test(0z080000000005040101, 'E758:')
+ " SN_COMPOUND: missing comppattern
+ call Spellfile_Test(0z08000000000704010100000001, 'E758:')
+
+ " SN_COMPOUND: incorrect comppatlen
+ call Spellfile_Test(0z080000000007040101000000020165, 'E758:')
+
" SN_INFO: missing info
call Spellfile_Test(0z0F0000000005040101, '')
***************
*** 317,322 ****
--- 331,342 ----
" SN_MAP: missing midword
call Spellfile_Test(0z0700000000040102, '')
+ " SN_MAP: empty map string
+ call Spellfile_Test(0z070000000000FF000000000000000000000000, '')
+
+ " SN_MAP: duplicate multibyte character
+ call Spellfile_Test(0z070000000004DC81DC81, 'E783:')
+
" SN_SYLLABLE: missing SYLLABLE item
call Spellfile_Test(0z0900000000040102, '')
***************
*** 333,344 ****
--- 353,373 ----
" LWORDTREE: missing tree node value
call Spellfile_Test(0zFF0000000402, 'E758:')
+ " LWORDTREE: incorrect sibling node count
+ call Spellfile_Test(0zFF00000001040000000000000000, 'E759:')
+
" KWORDTREE: missing tree node
call Spellfile_Test(0zFF0000000000000004, 'E758:')
" PREFIXTREE: missing tree node
call Spellfile_Test(0zFF000000000000000000000004, 'E758:')
+ " PREFIXTREE: incorrect prefcondnr
+ call Spellfile_Test(0zFF000000000000000000000002010200000020, 'E759:')
+
+ " PREFIXTREE: invalid nodeidx
+ call Spellfile_Test(0zFF00000000000000000000000201010000, 'E759:')
+
let &rtp = save_rtp
call delete('Xtest', 'rf')
endfunc
***************
*** 506,511 ****
--- 535,548 ----
let output = execute('mkspell! -ascii Xwordlist.spl Xwordlist.dic')
call assert_match('Ignored 1 words with non-ASCII characters', output)
+ " keep case of a word
+ let lines =<< trim [END]
+ example/=
+ [END]
+ call writefile(lines, 'Xwordlist.dic')
+ let output = execute('mkspell! Xwordlist.spl Xwordlist.dic')
+ call assert_match('Compressed keep-case:', output)
+
call delete('Xwordlist.spl')
call delete('Xwordlist.dic')
endfunc
***************
*** 706,711 ****
--- 743,777 ----
let output = execute('mkspell! Xtest.spl Xtest')
call assert_match('Illegal flag in Xtest.aff line 2: L', output)
+ " missing character in UPP entry. The character table is used only in a
+ " non-utf8 encoding
+ call writefile(['FOL abc', 'LOW abc', 'UPP A'], 'Xtest.aff')
+ let save_encoding = &encoding
+ set encoding=cp949
+ call assert_fails('mkspell! Xtest.spl Xtest', 'E761:')
+ let &encoding = save_encoding
+
+ " character range doesn't match between FOL and LOW entries
+ call writefile(["FOL \u0102bc", 'LOW abc', 'UPP ABC'], 'Xtest.aff')
+ let save_encoding = &encoding
+ set encoding=cp949
+ call assert_fails('mkspell! Xtest.spl Xtest', 'E762:')
+ let &encoding = save_encoding
+
+ " character range doesn't match between FOL and UPP entries
+ call writefile(["FOL \u0102bc", "LOW \u0102bc", 'UPP ABC'], 'Xtest.aff')
+ let save_encoding = &encoding
+ set encoding=cp949
+ call assert_fails('mkspell! Xtest.spl Xtest', 'E762:')
+ let &encoding = save_encoding
+
+ " additional characters in LOW and UPP entries
+ call writefile(["FOL ab", "LOW abc", 'UPP ABC'], 'Xtest.aff')
+ let save_encoding = &encoding
+ set encoding=cp949
+ call assert_fails('mkspell! Xtest.spl Xtest', 'E761:')
+ let &encoding = save_encoding
+
" duplicate word in the .dic file
call writefile(['2', 'good', 'good', 'good'], 'Xtest.dic')
call writefile(['NAME vim'], 'Xtest.aff')
*** ../vim-8.2.1650/src/version.c 2020-09-09 22:27:55.429537066 +0200
--- src/version.c 2020-09-09 22:42:19.818862080 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1651,
/**/
--
John: When I'm playing tennis with friends I always get carried away
George: You hurt your foot each time?
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202009092043.089KhpX0444032%40masaka.moolenaar.net.